Source : Specifies the path to the source directory. Destination : Specifies the path to the destination directory. File : Specifies the file or files to be copied. You can use wildcard characters (* or ?), if you want. Options : Specifies options to be used with the robocopy command.
Robocopy, or Robust File Copy, is a command line directory replication tool from Microsoft. It has the same abilities as more familiar commands such as copy and xcopy, the biggest difference is that its not a file copier, it was made to copy folders and keep them in the same form as they were.
Using Robocopy, you can copy a single directory, or you can recursively copy a directory and its subdirectories. It is an advanced copy utility with has the feature to automatically resume file transfer on error or network disruption, or recover from terminated file copying, plus selective copying based on new or updated criteria. This tool helps maintain identical copies of a directory structure on a single computer or in separate network locations.
Another noted feature of Robocopy is that a file exists in both the source and destination locations, by default Robocopy copies the file only if the two versions have different time stamps or different sizes. This saves time if the source and destination are connected by a slow network link. You can also specify that copies are restarted in the event of a failure, which saves even more time when your network links are unreliable.
Robocopy came built-in in Windows operating system such as Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 and Windows Server with command line interface only. After all, Robocopy prints a detailed report of the copy operation and you can view the real time progress monitoring of source and destination targets.
Robocopy and a Few Examples
How to copy content of a foler to another folder
C:\>robocopy c:\temp D:\backup\mis\dev
Copy a directory
C:\>robocopy c:\temp\newtemp D:\backup\mis\dev\newtemp
C:\>robocopy /S c:\temp D:\backup\mis\dev
Copy the content of folder including empty folder
C:\>robocopy c:\temp D:\backup\mis\dev /E
Copy files larger than specified size
C:\>robocopy C:\temp\newtemp D:\backup\mis\dev /min:4096
The above command copy files from c:\temp\newtemp whose size is larger than 4kb (4096)
Copy files less tha specified size
C:\>robocopy C:\temp\newtemp D:\backup\mis\dev /max:5120
The above command copy files from c:\temp\newtemp whose size is less than 5kb (5120)
C:\>robocopy c:\temp D:\backup\mis\dev /MIR
The above command will mirror what is in c:\tempe into D:\backup\mis\dev and purge any files in the D:\backup\mis\dev directory that do not exist in the hope directory.
Use the /MIR switch carefully since it will be deleting files that do not match in the destination directory.
Copy from network
C:\>robocopy \\SERVER\backup\temp D:\backup\mis\dev
The above example would copy any of the files in the temp directory on the network computer (\\SERVER\backup\temp) to the current computer D:\backup\mis\dev directory.
Copy a directory tree
C:\>robocopy C:\temp D:\backup\mis\dev /MIR /dcopy:TThe above command to copy a directory tree along with the source timestamps for folders
Delete the source after copying
C:\>robocopy c:\temp\newtemp D:\backup\mis\dev /mov /s
The above command delete the content in the folder c:\temp\newtemp after copying the content to c:\temp\newtemp
Move the files older than specified days
C:\>robocopy c:\temp\newtemp D:\backup\mis\dev /move /minage:10
The above command move files over 10 days old, however the MOVE option will fail if any files are open and locked.
Copy files without overwrite
C:\>robocopy c:\temp D:\backup\mis\dev /E /XC /XN /XO
The above command copy files from source folder to destination folder without overwrite.
/E makes Robocopy recursively copy subdirectories, including empty ones.
/XC excludes existing files with the same timestamp, but different file sizes. Robocopy normally overwrites those.
/XN excludes existing files newer than the copy in the source directory. Robocopy normally overwrites those.
/XO excludes existing files older than the copy in the source directory. Robocopy normally overwrites those.
Hide ROBOCOPY output
How to make robocopy silent in the command line
ROBOCOPY [source] [target] /NFL /NDL /NJH /NJS /nc /ns /np
/NFL : No File List - don't log file names.
/NDL : No Directory List - don't log directory names.
/NJH : No Job Header.
/NJS : No Job Summary.
NEXT.....How to WMIC ?