If you'd prefer to just overwrite the old log file, use /log.txt. The /log+ modifier will append the existing log file instead of overwriting it.
robocopy "C:\Users\My Documents" "D:\backup\My Documents" /log+.txt This can help you pinpoint problems or generate an archive of what's been copied. robocopy allows you to create a log file. robocopy "C:\Users\My Documents" "D:\backup\My Documents" /z You may want to include the ability to restart the process in case the connection is severed mid-copy. This function will preserve all permissions of the original files.Įnable restarting. For example, to mirror C:\Users\My Documents to D:\backup\My Documents, enter the following: robocopy "C:\Users\My Documents" "D:\backup\My Documents" /mir This ensures that your backup only has the latest versions of your files.
It will then delete anything at the destination that doesn't exist at the source. The mirror option of robocopy will copy all of the contents from the source to the destination. Mirroring a directory is great for making backups. It will create new directories if they don't exist at the target location. Robocopy will automatically copy hidden and system files. The /e modifier tells robocopy to include all subdirectories. For example, to copy all of the contents of the C:\tools directory to the new folder D:\backup\tools, enter the following: robocopy C:\tools D:\backup\tools /e It can quickly copy entire folders without having to worry about defining the contents. The robocopy command replaces the xcopy command. Creating scripts with robocopy will future-proof them.
xcopy has been deprecated and will likely be phased out of use in the near future. Use ROBOCOPY if you're creating backup scripts.