:: ------------------------------------------------------------------------------- :: ROBOCOPYBACKUP :: Robust File Copy for Backups :: ------------------------------------------------------------------------------- :: Usage :: ROBOCOPY source destination :: :: source :: Source Directory (drive:\path or \\server\share\path). :: destination :: Destination Dir (drive:\path or \\server\share\path). :: :: Copy options : :: :: /E :: copy subdirectories, including Empty ones (USES /MIR INSTEAD) :: /ZB :: use restartable mode; if access denied use Backup mode. :: /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU). :: /PURGE :: delete dest files/dirs that no longer exist in source. (USES /MIR INSTEAD) :: /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE). :: /MT:4 :: Do multi-threaded copies with n threads (default 8). :: :: File Selection Options : :: :: /M :: copy only files with the Archive attribute and reset it. :: :: Retry Options : :: :: /R:10 :: number of Retries on failed copies: default 1 million. :: /W:10 :: Wait time between retries: default is 30 seconds. :: :: Logging Options : :: :: /L :: List only - don't copy, timestamp or delete any files. (USE FOR TESTING ONLY) :: :: /NS :: No Size - don't log file sizes. :: /NC :: No Class - don't log file classes. :: /NFL :: No File List - don't log file names. :: /NDL :: No Directory List - don't log directory names. :: :: /NP :: No Progress - don't display percentage copied. :: :: /LOG:file :: output status to LOG file (overwrite existing log). :: :: Generate Unique Filename for Log File :: echo off for /F "tokens=2" %%i in ('date /t') do set mydate=%%i set mydate=%mydate:/=-% set mytime=%time::=-% set logfilename=%mydate%-%mytime%.log :: echo %logfilename% :: :: Set the Source and Destination Folder Names :: set sourcefolder="E:\BACKUP\Test" set destfolder="E:\BACKUP\Rotation" :: echo %sourcefolder% :: echo %destfolder% :: :: Execute Robocopy with appropriate parameters :: ROBOCOPY %sourcefolder% %destfolder% /ZB /COPYALL /MIR /MT:4 /R:10 /W:10 /NS /NC /NFL /NDL /NP /LOG:%logfilename% :: /NS /NC /NFL /NDL /NP (add these flags to clean up log file detail)
Thank you for visiting! Please take a moment to register so that you can participate in discussions!