Robocopy exclude Directories

Just trying to copy everything…

Login

Blog History

Just trying to copy everything except a couple of directories from a drive to my NAS

This is the secret incantation of robocopy when running in a Power Shell Terminal on Windows 11

robocopy d:\ \\mynas\toggen\DATA\ *.* /XD 'D:\$RECYCLE.BIN' 'D:\.Trash-1000' /E /Z

From source drive D:\

copy all files and directories (*.*)

including empty ones (/E)

If we have to restart don't recopy partial files but restart where you left off (/Z)

exclude the following directories for the copy (/XD 'D:\$RECYCLE.BIN' and 'D:.Trash-1000')

Because we are using a Powershell terminal use single quotes to stop Powershell thinking `$RECYCLE.BIN' is a variable

0 Comments

Submit a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.