Guest muke Posted March 5, 2004 Posted March 5, 2004 Here's a section of a directory backup script that runs on a scheduled task. I'm currently checking for the existence of a file in the backup dir to verify successful completion. Is there a way to compare the contents of the source and destination directories? Thanks. --------------------------------------------- ;Set Variables SetEnv, BackUpPath, c:\\temp\\bak SetEnv, WorkingPath, c:\\temp\\working ;Perform the copy. FileCopy, %WorkingPath%\\*.*, %BackupPath%\\*.* Sleep, 1000 ;Check for the existence of a file in bak, if exists, continue. If not, display a message and exit. IfNotExist, %BackupPath%\\zzz.txt, Goto, fileNotexist Goto, fileexist1 fileNotexist: ; Script will go here if %BackupPath%\\zzz.txt DOES NOT exist. SplashTextOn, 320, 120, Backup, Not All Files from '%WorkingPath%' were copied successfully. Exiting. Sleep, 2000 SplashTextOff Exit ;Check for the existence of a file in bak, if exists, continue. IfExist, %BackupPath%\\zzz.txt, Goto, fileexist1 Exit fileexist1: ; Script will go here if %BackupPath%\\zzz.txt exists. SplashTextOn, 300, 100, Backup, Copy Completed Successfully. Sleep, 2000 SplashTextOff Exit
Beastmaster Posted March 5, 2004 Posted March 5, 2004 (edited) What about DOS? xcopy32 c:\customer\*.* f:\backup\%1\ /s /m- All all files from c:\customer directory (and its subdirectories) will be copied to f:\backup. %1 stands for the current date. /s /m triggers that only those files will be copied which have changed. So there's no need to compare both directories about their content. RunWait, %COMSPEC% /C xcopy32 <SourceDirectory>\\*.* <DestinationDirectory>\\%1\\ /s /m- ----- Google: daily backup xcopy Edited March 5, 2004 by Beastmaster
ezzetabi Posted March 5, 2004 Posted March 5, 2004 and a low priced wonderful program for that could be xxcopy www.xxcopy.com it is great. Also what about dir /b /ogn (first folder)>file1.txt dir /b /ogn (second folder)>file2.txt and compare the two files?
Recommended Posts