Script to Restore Files Based File Name

Hello,
We accidentally deleted files. We have a backup but it is not reliable and did not backup these files properly. A lot of them are missing. We do happened to have these missing files archived in another location. I would like to see if we can automate a restore from this archived location.

The main production network share has a structure of "C:FTP FolderPO#DatePO#_Item#League_Item#_Team_Player_Color". To find this path in the "archived" location we need to use the last folder in the main production path (ex: League_Item#_Team_Player_Color). So, after each underscore is another folder in the archived location. So we would go to the archived location and it would be "F:LeagueItem#TeamPlayerColor". Is there a script that we can make to pull the files from the archived location to the main production share?

Not sure if this is possible via a script, but that is what I am hoping for.

Thank You!!



You asked for a way to automate this; is this because of the number of files or are you expecting to have to repeat this procedure?

For a one-time restore, XCopy or RoboCopy may suit your needs.

Krompton



You asked for a way to automate this; is this because of the number of files or are you expecting to have to repeat this procedure?

For a one-time restore, XCopy or RoboCopy may suit your needs.

Krompton



Try this batch file:



Missed a little. Try this one:



So, you want to look at each of these folders in the main server location, and then do what? Copy all files from the backup location? What if they already exist in the main server, overwrite, or skip?

~bp



REVISED:
If you need to process multiple folders in source folder c:ftp, try this.

Note:- I've placed an ECHO so you can see what the command does. It does not do the actual copy. To run it for real, remove the ECHO
- I used XCOPY command. Of course, use whatever command you like.

Share this

Related Posts

There was an error in this gadget