Jump to content

How do I keep this .bat file from overwriting

Corvus
Go to solution Solved by WanderingFool,

Sorry I have to run so I can't really explain this, but try looking at this

 

http://stackoverflow.com/questions/4984391/cmd-line-rename-file-with-date-and-time

 

you can use %date%...although I don't know how to do it with the *.* only way I can think of off hand is if the save file is already known

Hi there, I'm trying to make a simple script that will backup my save files every half hour or so in order to avoid getting my saves corrupted again while playing Watch_Dogs. 

So far I've managed to do the basics, copying the saves to another location and I'm planning to use task scheduler to execute the file every hour or so. However, I would like the saves to be renamed after the time it was backed up (could possibly be done by renaming the entire folder creating a new one) and not overwritten. How can I do this? And is there a better way to make the script run at intervals? (i.e, only after I execute it the first time, and stop when I exit it.) 

This is what I have come up with so far for testing purposes:
 

@Echo off
cls
xcopy "F:\Program Files\Ubisoft\Ubisoft Game Launcher\savegames\2f638c41-7fa3-4189-8aa1-be9d10d5adea\"*.* "C:\Backups\WatchDogs" /s /e
echo backup complete
Pause
End

Note that I will remove the echo and the pause. It is just so that I know that it is working.

Thanks in advance.

 
CPUIntel Core I5-3570k @4.2Ghz |  CoolerBeQuiet! Dark Rock Pro 2 | MOBOMsi Z77 Mpower | GPUSapphire HD7970 Dual-X 3GB RAMCorsair Vengeance Low Profile 1600mhz (2x8GB) | HDD Samsung SSD 840 EVO 120GB & HGST Deskstar NAS 3TB | PSU: BeQuiet! PurePower L8 630w | Case: Corsair C70 Military Green | Display: BenQ GL2450HM 24" KeyboardCM Storm QuickFire Ultimate Keyboard (Browns) | MouseR.A.T 7 | Mouse padSteelseries QcK Mass | Headset: Plantronics Gamecom 780 | OS: Windows 7 Ultimate | Picture of setuphttp://i.imgur.com/o8jKsQJ.jpg (OLD)

Link to comment
Share on other sites

Link to post
Share on other sites

Best I can think of off the top the extension  "/-y" . But that only allows you to confirm the over write. Is there any option to autosave using a time/date stamp in watch dogs? (never play, and probably never will).

MOBO: ASUS X79 Pro CPU: i7 3820 Ram: Corsair Vengence 32Gb 2133mhz (8x4) GPU: 2 x Sapphire R9 290 in X-fire PSU: Seasonic G series 750w Drives: 1 x 750 gig WD black, 3x WD Black 1TB, 1 x Segate Barrcuda 1 TB, 1 x Toshiba 2TB, Intel 520 240gig SSD Case: Enthoo Primo w/ Green and Blue LED lighting.

Link to comment
Share on other sites

Link to post
Share on other sites

Sadly there is no options concerning the saves, you can't even have more than one save. 

 
CPUIntel Core I5-3570k @4.2Ghz |  CoolerBeQuiet! Dark Rock Pro 2 | MOBOMsi Z77 Mpower | GPUSapphire HD7970 Dual-X 3GB RAMCorsair Vengeance Low Profile 1600mhz (2x8GB) | HDD Samsung SSD 840 EVO 120GB & HGST Deskstar NAS 3TB | PSU: BeQuiet! PurePower L8 630w | Case: Corsair C70 Military Green | Display: BenQ GL2450HM 24" KeyboardCM Storm QuickFire Ultimate Keyboard (Browns) | MouseR.A.T 7 | Mouse padSteelseries QcK Mass | Headset: Plantronics Gamecom 780 | OS: Windows 7 Ultimate | Picture of setuphttp://i.imgur.com/o8jKsQJ.jpg (OLD)

Link to comment
Share on other sites

Link to post
Share on other sites

Sorry I have to run so I can't really explain this, but try looking at this

 

http://stackoverflow.com/questions/4984391/cmd-line-rename-file-with-date-and-time

 

you can use %date%...although I don't know how to do it with the *.* only way I can think of off hand is if the save file is already known

0b10111010 10101101 11110000 00001101

Link to comment
Share on other sites

Link to post
Share on other sites

Sorry I have to run so I can't really explain this, but try looking at this

 

http://stackoverflow.com/questions/4984391/cmd-line-rename-file-with-date-and-time

 

you can use %date%...although I don't know how to do it with the *.* only way I can think of off hand is if the save file is already known

Thank you for this info, going to do some experimenting considering that all the save files have a set name. (2.save.upload, 2.save, 1.save.upload, 1.save)

Quick note to everyone however:

I have only done some simple scripts before, and thus I don't fully understand what I'm doing here. Any help would be much appreciated. :)

 
CPUIntel Core I5-3570k @4.2Ghz |  CoolerBeQuiet! Dark Rock Pro 2 | MOBOMsi Z77 Mpower | GPUSapphire HD7970 Dual-X 3GB RAMCorsair Vengeance Low Profile 1600mhz (2x8GB) | HDD Samsung SSD 840 EVO 120GB & HGST Deskstar NAS 3TB | PSU: BeQuiet! PurePower L8 630w | Case: Corsair C70 Military Green | Display: BenQ GL2450HM 24" KeyboardCM Storm QuickFire Ultimate Keyboard (Browns) | MouseR.A.T 7 | Mouse padSteelseries QcK Mass | Headset: Plantronics Gamecom 780 | OS: Windows 7 Ultimate | Picture of setuphttp://i.imgur.com/o8jKsQJ.jpg (OLD)

Link to comment
Share on other sites

Link to post
Share on other sites

Alright, a little update.

I've managed to make it so that the files aren't replaced anymore as it is saved. This is what I've managed so far:

@Echo off
cls
:Start
 
xcopy "F:\Program Files\Ubisoft\Ubisoft Game Launcher\savegames\2f638c41-7fa3-4189-8aa1-be9d10d5adea\274\2.save.upload" "C:\Backups\WatchDogs" /s /e /Y
 
ren C:\Backups\WatchDogs\2.save.upload 2.save.upload-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~0,2%%time:~3,2%.upload
ren C:\Backups\WatchDogs\2.save.upload 2.save.upload-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~1,1%%time:~3,2%.upload
 
xcopy "F:\Program Files\Ubisoft\Ubisoft Game Launcher\savegames\2f638c41-7fa3-4189-8aa1-be9d10d5adea\274\2.save" "C:\Backups\WatchDogs" /s /e /Y
 
ren C:\Backups\WatchDogs\2.save 2.save-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~0,2%%time:~3,2%.save
ren C:\Backups\WatchDogs\2.save 2.save-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~1,1%%time:~3,2%.save
 
xcopy "F:\Program Files\Ubisoft\Ubisoft Game Launcher\savegames\2f638c41-7fa3-4189-8aa1-be9d10d5adea\274\1.save.upload" "C:\Backups\WatchDogs" /s /e /Y
ren C:\Backups\WatchDogs\1.save.upload 1.save.upload-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~0,2%%time:~3,2%.upload
ren C:\Backups\WatchDogs\1.save.upload 1.save.upload-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~1,1%%time:~3,2%.upload
 
xcopy "F:\Program Files\Ubisoft\Ubisoft Game Launcher\savegames\2f638c41-7fa3-4189-8aa1-be9d10d5adea\274\1.save" "C:\Backups\WatchDogs" /s /e /Y
ren C:\Backups\WatchDogs\1.save 1.save-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~0,2%%time:~3,2%.save
ren C:\Backups\WatchDogs\1.save 1.save-%date:~10,4%%date:~7,2%%date:~4,2%_%time:~1,1%%time:~3,2%.save
 
 
echo backup complete
Timeout /T 3600 /NOBREAK
 
Goto :Start
Pause
End


This basically copies the files to the selected location, and then renames them after the time it was backed up. Not quite sure on how to change it to save after time & date just yet however. 

EDIT: I successfully made it so that it waits for an hour, and then runs the script again, and then continues to repeat it until I close it.

I have also tested if the saves work or not after this backup process, and it seems as if they work just fine. 

Thank you @Maxwit44 and @WanderingFool for the help. :)
 

 
CPUIntel Core I5-3570k @4.2Ghz |  CoolerBeQuiet! Dark Rock Pro 2 | MOBOMsi Z77 Mpower | GPUSapphire HD7970 Dual-X 3GB RAMCorsair Vengeance Low Profile 1600mhz (2x8GB) | HDD Samsung SSD 840 EVO 120GB & HGST Deskstar NAS 3TB | PSU: BeQuiet! PurePower L8 630w | Case: Corsair C70 Military Green | Display: BenQ GL2450HM 24" KeyboardCM Storm QuickFire Ultimate Keyboard (Browns) | MouseR.A.T 7 | Mouse padSteelseries QcK Mass | Headset: Plantronics Gamecom 780 | OS: Windows 7 Ultimate | Picture of setuphttp://i.imgur.com/o8jKsQJ.jpg (OLD)

Link to comment
Share on other sites

Link to post
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

×