How to Copy Files and Folders with ACL Permissions

 In this post I will step-by-step guide you on how to copy files and folders while preserving the security permissions (ACL).

An Octopus copying files - UFOtechs


When migrating data between file servers, ensuring the preservation of files, folders, and their associated Access Control Lists (ACLs) is crucial to maintain security and access permissions. This guide will demonstrate how to achieve this using Robocopy and introduce a tool called OctoCopy, which simplifies the process.


Scenario Overview

Imagine you have an old Windows FileServer and a newly created one. Your objective is to transfer data from the old server to the new one without losing security permissions.


Using Robocopy via Command Prompt

Robocopy (Robust File Copy) is a powerful command-line utility in Windows, designed for efficiently copying files, folders, and their ACLs. Follow the steps below to perform the operation:


Steps:

  1. Open Command Prompt with administrative privileges.
  2. Define the source and destination paths.
  3. Use the following script:

    SET SORC="\\server\share"

    SET DEST="Z:\WHERE YOU WANT FILES TO GO"

    SET LOG="Z:\THE LOG FILE.log"

    ROBOCOPY %SORC% %DEST% /MIR /SEC /R:1 /W:1 /NP /LOG:%LOG%{codeBox}


Explanation of the Parameters:

  • /MIR: Mirrors the directory structure, including subfolders and files.
  • /SEC: Ensures security permissions (ACLs) are copied.
  • /R:1: Specifies a retry limit of 1 for locked files.
  • /W:1: Sets a 1-second wait time between retries.
  • /NP: Disables the progress display for faster output.
  • /LOG: Writes operation details to the specified log file.

Verify that the destination path is accessible and has sufficient permissions.{alertInfo}

If the source and destination servers belong to different domains, ensure proper trust relationships are configured.{alertInfo}


Introducing OctoCopy

While Robocopy is a powerful tool, it requires manual configuration and careful attention to parameters, which can be challenging for some users. To address this, I have developed OctoCopy, a streamlined PowerShell-based tool that automates the process.


Key Features of OctoCopy:

  • Simplifies the setup by requiring only source and destination inputs.
  • Automates the execution of Robocopy commands with optimal parameters.
  • Generates comprehensive logs for auditing and troubleshooting.
  • User-friendly and efficient.


How to Use OctoCopy

  • Execute Directly from PowerShell:
    Run the following command in a PowerShell session (requires an internet connection):
    irm https://bit.ly/OctoCopy_v1-0 | iex{codeBox}
     

Once installed or executed, simply provide the source and destination paths, and OctoCopy will handle the rest.


Conclusion

Transferring files and folders with their ACLs is essential for maintaining security integrity during server migrations. Using Robocopy ensures precise control, while OctoCopy provides a simplified, automated alternative for users seeking efficiency and ease of use.

If you have any questions or need further assistance, feel free to reach out or leave a comment below.

Post a Comment

Previous Post Next Post

Contact Form