Skip to main content

MS-DOS and Windows command line robocopy command

Robocopy is a robust file copy command for the Windows command line. It allows users to copy files, directories, and even drives from one location to another. 
Robocopy is an external command that is available for the following Microsoft operating systems as robocopy.exe.

Robocopy syntax

ROBOCOPY source destination [file [file]...] [options]
sourceSource directory (drive:\path or \\server\share\path).
destinationDestination directory (drive:\path or \\server\share\path).
fileFile(s) to copy (names/wildcards: default is "*.*").
Copy options
/SCopy subdirectories, but not the empty ones.
/ECopy subdirectories, including the empty ones.
/LEV:nOnly copy the top n levels of the source directory tree.
/ZCopy files in restartable mode.
/BCopy files in backup mode.
/ZBUse restartable mode. If access denied, use backup mode.
/EFSRAWCopy all encrypted files in EFS RAW mode.
/COPY:copyflag[s]What to COPY for files (default is /COPY:DAT).
(copyflags : D=Data, A=Attributes, T=Timestamps).
(S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
/DCOPY:TCOPY the directory timestamps.
/SECCopy files with security (equivalent to /COPY:DATS).
/COPYALLCopy all file info (equivalent to /COPY:DATSOU).
/NOCOPYCopy no file info (useful with /PURGE).
/SECFIXFix file security on all files, even skipped files.
/TIMFIXFix file times on all files, even the skipped ones.
/PURGEDelete dest files/dirs that no longer exist in the source.
/MIRMirror a directory tree (equivalent to /E plus /PURGE).
/MOVMove files (delete from the source after copying).
/MOVEMove files and dirs (delete from the source after copying).
/A+:[RASHCNET]Add the given attributes to copied files.
/A-:[RASHCNET]Remove the given attributes from copied files.
/CREATECreate directory tree and zero-length files only.
/FATCreate destination files using 8.3 FAT file names only.
/256Turn off very long path (> 256 characters) support.
/MON:nMonitor source; run again when more than n changes seen.
/MOT:mMonitor source; run again in m minutes time, if changed.
/RH:hhmm-hhmmRun hours - times when new copies may be started.
/PFCheck run hours on a per file (not per pass) basis.
/IPG:nInter-packet gap (ms), to free bandwidth on slow lines.
/SLCopy symbolic links versus the target.
/MT[:n]Do multi-threaded copies with n threads (default 8).
n must be at least 1 and not greater than 128.
This option is incompatible with the /IPG and /EFSRAW options.
Redirect output using /LOG option for better performance.
File Selection Options
/ACopy only the files with the archive attribute set.
/MCopy only the files with the archive attribute and reset it.
/IA:[RASHCNETO]Include only the files with any of the given attributes set.
/XA:[RASHCNETO]Exclude files with any of the given attributes set.
/XF file [file]...Exclude files matching given names/paths/wildcards.
/XD dirs [dirs]...Exclude directories matching given names/paths.
/XCExclude changed files.
/XNExclude newer files.
/XOExclude older files.
/XXExclude extra files and directories.
/XLExclude lonely files and directories.
/ISInclude same files.
/ITInclude tweaked files.
/MAX:nMaximum file size - exclude files bigger than n bytes.
/MIN:nMinimum file size - exclude files smaller than n bytes.
/MAXAGE:nMaximum file age - exclude files older than n days/date.
/MINAGE:nMinimum file age - exclude files newer than n days/date.
/MAXLAD:nMaximum last access date - exclude files unused since n.
/MINLAD:nMinimum last access date - exclude files used since n.
(If n < 1900 then n = n days, else n = YYYYMMDD date).
/XJExclude junction points. (normally included by default).
/FFTAssume FAT file times (2-second granularity).
/DSTCompensate for one-hour DST time differences.
/XJDExclude junction points for directories.
/XJFExclude junction points for files.
Retry Options
/R:nNumber of retries on failed copies: default 1 million.
/W:nWait time between retries: default is 30 seconds.
/REGSave /R:n and /W:n in the registry as default settings.
/TBDWait for sharenames To be defined (retry error 67).
Logging Options
/LList only - don't copy, timestamp or delete any files.
/XReport all extra files, not only those selected.
/VProduce verbose output, showing skipped files.
/TSInclude source file timestamps in the output.
/FPInclude full pathname of files in the output.
/BYTESPrint sizes as bytes.
/NSNo size - don't log file sizes.
/NCNo class - don't log file classes.
/NFLNo file list - don't log file names.
/NDLNo directory List - don't log directory names.
/NPNo progress - don't display percentage copied.
/ETAShow estimated time of arrival of copied files.
/LOG:fileOutput status to LOG file (overwrite existing log).
/LOG+:fileOutput status to LOG file (append to existing log).
/UNILOG:fileOutput status to LOG file as UNICODE (overwrite existing log).
/UNILOG+:fileOutput status to LOG file as UNICODE (append to existing log).
/TEEOutput to console window, as well as the log file.
/NJHNo job header.
/NJSNo job summary.
/UNICODEOutput status as UNICODE.
Job Options
/JOB:jobnameTake parameters from the named job file.
/SAVE:jobnameSave parameters to the named job file.
/QUITQuit after processing command line (to view parameters).
/NOSDNo source directory is specified.
/NODDNo destination directory is specified.
/IFInclude the following files.

Robocopy examples

robocopy c:\test c:\test2 *.txt
In this first example, any .txt file would be copied from the test directory into the test2 directory. Whenever you want to copy one or more files and not a complete directory the file must be specified after the destination directory.
robocopy c:\test c:\test2
In the above example, the robocopy command would copy all files (not directories) in the test directory to the test2 directory.
robocopy c:\test c:\test2 /e
In the above example, all files and folders (including empty ones) will be copied from the test directory to the test2 directory.
robocopy c:\test c:\test2 /MIR
This example will mirror what is in c:\hope into c:\test2 and purge any files in the test2 directory that do not exist in the test directory. Use the /mir switch cautiously since it is deleting files that do not match in the destination directory.
robocopy \\mypc\test C:\test2
Next, this example would copy any of the files in the test directory on the network computer named mypc to the current computer test2 directory.

Comments

Popular posts from this blog

IBM iAccess for windows 7.1 "a system restart is pending" error

 IBM iAccess for windows 7.1 "a system restart is pending" error HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager 1. Look for the following key:  PendingFileRenameOperations or   FileRenameOperations ** 2. Right-click ->  Rename . 3. Add a prefix ### and press Enter. 4. Close regedit and attempt the installation.  Note:  Make sure to go back and remove the ### prefix. The installation should continue.

How to change processor name permanently to fool your friends

How to change processor name permanently to fool your friends ------------------------------ ------------------------------ -------------- Would you like to show a brand new processor name which may not even published on market? Yes, definitely you will like it! With this trick, you can change the name of your processor to a personalized one like Intel i12 or something extreme like AMD Radon 30 GHz . So follow the given steps, Steps you have to perform 1. Open Notepad. Copy and paste below code into file. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\HARDWARE\D ESCRIPTION\System\CentralProce ssor\0] "ProcessorNameString"="Intel(R ) Core(TM) i12-3470 CPU @ 32.5GHz " How to change processor name -- 2. Save the file with .reg extension, such as "anyname.reg". How to change processor name permanantly 3. Double click on file. You will get two prompt, Just allow them to install registry key. How to change processor n