*UPDATED*Just Made myself a Backup Batch File! I so proud of me!
December 9th, 2009
*There were a couple of miner errors like moving the wrong files all together! ha! missed a slash before the *.*
I just spent all after noon creating this backup batch file. (I’m a 3D artist not a programmer) If you do any kind of work on your computer and it’s at all any important you will probably want to back it up. There’s probably a utility in windows to do this already but for some reason I was stuck on making this.
It creates backup log folders organized by dates and tells you which files were backed up. I also only have it backing up files that are new or most recent so it doesn’t copy everything every time. (I have 100′s of gigs in 3D project files.) If you want to change these settings, do a “help xcopy” in a cmd window. Change the source and Destination DIRS to match what you want to back up and to where. just drop this into a .bat file and schedule it or run it when you want. If anyone has suggestions our you like it feel free to comment.
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
@Echo off
IF not exist “BackupLog\” (Echo BackupLog Folder not found
Echo Creating BackupLog Folder
md BackupLog
) else (
Echo BackupLog folder already exists.
)
Echo Beginning back up now…
Echo \/>>BackupLog\log
Echo —————————————————————- >>BackupLog\log
Echo beginning of backup %date% %time% >>BackupLog\log
xcopy /d /e /h /r /y /f /k G:\Projects\*.* D:\Projects\ >>BackupLog\log
Echo Backup Finished %date% %time% >>BackupLog\log
Echo —————————————————————- >>BackupLog\log
Echo /\>>BackupLog\log
cd backuplog
for /f “tokens=1-5 delims=/ ” %%d in (“%date%”) do set d=”%%e-%%f-%%g”
for /f “tokens=1-5 delims=/ ” %%d in (“%date%”) do set y=”%%g”
for /f “tokens=1-5 delims=:” %%d in (“%time%”) do set t=”%%d.%%eand%%fsec”
rename “log” “%d% %t%.log”
IF not exist “%y%\” (Echo BackupLog yearly Folder not found
Echo Creating BackupLog %y% Folder
md %y%
) else (
Echo BackupLog %y% folder already exists.
Echo Organizing Log into %y%…
)
move *.log %y%
pause
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\






Leave a Reply