HOW TO: Copy a Folder to Another Folder and Retain its Permissions
When you copy or move files and folders by using Windows Explorer, the permissions that are set on the files or folders may change. For example, when you copy a file in an NTFS file system volume or between two NTFS volumes, Windows 2000 treats it as a new file. As a new file, it takes on the permissions of the destination folder, and you become the CREATOR OWNER.
NOTE: You must have Write permission for the destination folder to copy files and folders.
You can use the Xcopy command with the /O/X/E/H/K switches to copy the files and retain the existing permissions that have been specifically applied to the file or files.
These switches have the following effects:
/H - Copies hidden and system files also.
/K - Copies attributes. Typically, Xcopy resets read-only attributes.
/O - Copies file ownership and ACL information.
/X - Copies file audit settings (implies /O).
- The security settings that are directly assigned to the files and folders are retained.
- The security settings that are inherited from the source parent folder are lost.
- The security settings of the destination folders are inherited.
- When you move files or folders to FAT volumes, the folders and files lose their NTFS permissions because FAT volumes do not support NTFS permissions.
back to the top
Copy a Folder to Another Folder and Retain its Permissions
- Click Start, and then click Run.
- In the Open box, type cmd, and then click OK.
- Type xcopy sourcedestination /O /X /E /H /K and then press ENTER, where source is the source path for the files to be copied, and destination is the destination path for the files.
ExampleType xcopy c:\olddocs c:\newdocs /O /X /E /H /K, and then press ENTER, where olddocs is the source folder and newdocs is the destination folder.
For more information about Xcopy switches, type xcopy /? at the command prompt, and then press ENTER. For additional information about Xcopy switches, click the article number below to view the article in the Microsoft Knowledge Base:
Article ID: 323007 - Last Review: 10/29/2007 18:03:56 - Revision: 3.4
- kbproductlink kbenv kbhowto kbhowtomaster KB323007