@ECHO OFF SET prefix=robocopy_backup REM This is the file that we're going to backup from our local drive SET source_dir="C:\Documents and Settings" REM This is the location where the files will be copied to REM on the external drive. SET dest_dir="F:\Windows XP Backup\Documents and Settings Backup" REM Set the log file name based on the current date. This REM will record the results from the robocopy command. REM The typical format for the date command is: REM Mon 11/09/2000 REM So, we are parsing the date by moving 4 characters back and REM copy 4 characters to get the 4-digit year, then we get the REM 2-digit month by moving 10 characters back and copying 2 REM characters. Finally, we get the day by moving 7 characters REM back and copying 2 characters. SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log REM See the robocopy documentation for what each command does. REM /COPY:DAT :: COPY file data, attributes, and timestamps REM /COPYALL :: COPY ALL file info REM /B :: copy files in Backup mode. REM /MIR :: MIRror a directory tree REM /L :: Just list the info, don't actually do it SET what_to_copy=/COPY:DAT /MIR REM Exclude some files and directories that include transient data REM that doesn't need to be copied. SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" "Cookies" "iPod Photo Cache" "MachineKeys" SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* *.lock *.swp REM Refer to the robocopy documentation for more details. REM /R:n :: number of Retries REM /W:n :: Wait time between retries REM /LOG :: Output log file REM /NFL :: No file logging REM /NDL :: No dir logging SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL REM Execute the command based on all of our parameters ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs% %exclude_files% :END