Created
March 29, 2024 10:59
-
-
Save kampelmuehler/10a688cff85a93c1fca22b84fee5066f to your computer and use it in GitHub Desktop.
Backup internal drive to external drive on Windows 10 using robocopy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy | |
:: Adjust the paths as needed | |
:: Explanation of the command options: | |
:: /MIR - We're using mirror to ensure the external copy (H:\Z\) is exactly what is the internal copy (Z:\) | |
:: /XO - Source directory files older than the destination are excluded from the copy. | |
:: /XD "$RECYCLE.BIN" "System Volume Information" - exclude those directories to avoid access issues | |
:: /log+:"Z:\backup.log" - append to a backup.log file on Z: | |
:: /tee - Writes the status output to the console window, and to the log file. | |
:: /nfl - Specifies that file names aren't to be logged, to avoid bloating the log file | |
:: /ndl - Specifies that directory names aren't to be logged, to avoid bloating the log file | |
:: /A-:SH - Removes system and hidden attributes from the copied files, if this is omitted the files/folder on the external copy might become hidden | |
robocopy Z:\ H:\Z\ /MIR /XO /XD "$RECYCLE.BIN" "System Volume Information" /log+:"Z:\backup.log" /tee /ndl /nfl /A-:SH | |
:: shutdown after robocopy is finished | |
shutdown /s /t 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment