1. Home
  2. Microsoft Windows
  3. Move shared folders & retain file and folder permissions with robocopy
  1. Home
  2. Windows Server
  3. Move shared folders & retain file and folder permissions with robocopy

Move shared folders & retain file and folder permissions with robocopy

*this commend will copy the source files to the destination, the source is not removed*

Here’s the command I typically use when I want to retain all permisions, ownership & timestamps of the entire folder structure and data:

robocopy source destination /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:Robocopy.log

Here’s what the switches mean:

  • source :: Source Directory (drive:\path or \\server\share\path).
  • destination :: Destination Dir  (drive:\path or \\server\share\path).
  • /E :: copy subdirectories, including Empty ones.
  • /ZB :: use restartable mode; if access denied use Backup mode.
  • /DCOPY:T :: COPY Directory Timestamps.
  • /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).  Copies the Data, Attributes, Timestamps, Ownser, Permissions and Auditing info
  • /R:n :: number of Retries on failed copies: default is 1 million but I set this to only retry once.
  • /W:n :: Wait time between retries: default is 30 seconds but I set this to 1 second.
  • /V :: produce Verbose output, showing skipped files.
  • /TEE :: output to console window, as well as the log file.
  • /LOG:file :: output status to LOG file (overwrite existing log).

If you are migrating a live share you can run

robocopy source destination  /XO

to copy only the changed files after the initial copy has been completed.

Updated on November 15, 2019

Was this article helpful?

Related Articles

Not the solution you were looking for?
Click the link below to create a support ticket
Submit Ticket

Comments

  1. Hi there, You mention move on your title but I hope it doesn’t delete the source files? The switches you have there, none of them mention that it is going to delete the source file but just wanted to make sure as this my first robocopy.

    Thank you

    1. It will not remove the source files, I use “robocopy F:\ H:\ /E /ZB /DCOPY:T /COPYALL /R:1 /W:1 /V /TEE /LOG:Robocopy.log” to mirror files from F: to H:

  2. Hi All,

    I am facing permission issue while copy from source to destination

    Data store in NAS
    Copied from window/NAS to Linux NAS share

    After copy, I am not unable to access the directory and its say permission issue.

  3. Hi there,

    I have a drive which is about to fail and has 2TB of data and I am trying to copy everything including the permissions to a new drive. would this work?

    Regards,

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.