Jump to content

FileCopy() - Multiple File Types


etidd
 Share

Recommended Posts

Just checking... :whistle:

Is there a better way to write this for 7 different file types?

FileCopy("C:\Users\------\Saved Games\Diablo II\*.d2s", "F:\Game Backup\Diablo II", $FC_OVERWRITE)
FileCopy("C:\Users\------\Saved Games\Diablo II\*.key", "F:\Game Backup\Diablo II", $FC_OVERWRITE)
FileCopy("C:\Users\------\Saved Games\Diablo II\*.ma0", "F:\Game Backup\Diablo II", $FC_OVERWRITE)
FileCopy("C:\Users\------\Saved Games\Diablo II\*.ma1", "F:\Game Backup\Diablo II", $FC_OVERWRITE)
FileCopy("C:\Users\------\Saved Games\Diablo II\*.ma2", "F:\Game Backup\Diablo II", $FC_OVERWRITE)
FileCopy("C:\Users\------\Saved Games\Diablo II\*.ma3", "F:\Game Backup\Diablo II", $FC_OVERWRITE)
FileCopy("C:\Users\------\Saved Games\Diablo II\*.map", "F:\Game Backup\Diablo II", $FC_OVERWRITE)

 

Link to comment
Share on other sites

I understand, not a big deal for me.  Just want to let you know about it.

But I have played a lot D2 in the past, and I do not believe Blizz agrees you to copy current character stat to another location, and come back if you die.

Edited by Nine
Link to comment
Share on other sites

Hi,

externally call robocopy.exe (included in Windows since XP), would be easy and quick. Have a look at the switch /if (include file), which can be used multiple times in the call.

The exitcode of robocopy will tell you exactly, what happened. Running it twice will give you an exitcode of 0 (zero), if source and destination match.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Just a loop : 

Local $aExt = ["*.d2s","*.key","*.ma0","*.ma1","*.ma2","*.ma3","*.map"]

For $ext in $aExt
    FileCopy("C:\Users\------\Saved Games\Diablo II\" & $ext, "F:\Game Backup\Diablo II")
Next

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...