A robocopy command that copies one mapped drive to another and keeps machine from sleeping

xcopy C:\Videos “\\SERVER\Media Backup” /f /j /s /w /z

# Set the system to high performance mode to prevent sleep
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

# Run Robocopy to copy the contents of the source drive to the destination drive
robocopy "\\server\source_drive" "\\server\destination_drive" /Z /PURGE /COPY:DAT /R:1 /W:1 /MT:32 /v /tee /log:C:\logs\robocopy.log

# Set the system back to its original power plan
powercfg -setactive 381b4222-f694-41f0-9685-ff5bb260df2e

# Less destructive

# Run Robocopy to copy the contents of the source drive to the destination drive
robocopy "\\server\source_drive" "\\server\destination_drive" /COPY:DAT /R:1 /W:1 /MT:32 /v /tee /log:C:\logs\robocopy.log

This command will copy the contents of the source drive to the destination drive, using the following options:

/Z: Copies files in restartable mode. If the copy is interrupted, it can be resumed from where it left off.
/PURGE: Deletes destination files and directories that no longer exist in the source.
/COPY:DAT: Copies data, attributes, and timestamps.
/R:1: Retries 1 times if an error occurs during the copy process.
/W:1: Waits 1 second between retries.
/MT:32: Uses 32 threads for the copy process, which can speed up the copy on multi-core machines.
/v: Verifies each file after it is copied to ensure that it was copied correctly.
/tee: Sends the output to both the console and a log file.
/log:C:\logs\robocopy.log: Saves the output to a log file located at C:\logs\robocopy.log

Link:
https://chat.openai.com/chat

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Share via
Copy link