How do I copy a folder's attributes or replicate a folder structure without its contents?

January 21, 2026 3 answers
Asked by !bring a sweater
I'm trying to figure out how to copy a folder's attributes, like the hidden flag and creation date, to another folder or to simply replicate a folder structure without transferring any of its contents. I thought about using Robocopy, but it doesn't seem to create the destination folder when I'm trying to copy. For example, if I run Robocopy from C:Source to C:Dest, it won't create the C:Dest folder itself. Is there a way to do this effectively?

Answers

408 relay test
You can actually use Robocopy for this! You need to specify the destination with the exact name of the source folder to copy the whole structure without the files. This should work for your case where you want to maintain the folder hierarchy. Just make sure you're directing it properly!

bridge tournament!: Totally agree! Robocopy is a powerful tool for this.

9 slices remain: But keep in mind it doesn't copy the root folder itself. Using the `/create` flag can replicate the hierarchy, but it doesnโ€™t give you the root folder. I've also noticed it creates 0 KB files, which is not what I want either. I'm really just after copying the main folder without any contents or attributes.

Reply to this answer
graph paper user
If you're using PowerShell, you can achieve this by replicating the folder structure with some script. Use `Get-ChildItem` to grab all directories you want to copy and then create new folders at your desired location. Hereโ€™s a sample code to help you out! $top_level_path = "C:Userspathtotop" $new_top_level_path = "C:Usersnewpathtop" $sub_paths = Get-ChildItem -Path $top_level_path -Recurse -Directory foreach ($path in $sub_paths) { $new_path = $path.FullName -replace "C:\Users\path\to\top", $new_top_level_path if (!(Test-Path -Path $new_path)) { New-Item -Path $new_path -ItemType Directory } }
Reply to this answer
screen brightness
Make sure to adjust your Robocopy command to include the necessary attributes. Try `/COPYALL` to include all attributes, or if you want to specify, use `/COPY:DATSOU` and leave out the ones youโ€™re not interested in. For just replicating the folder without data, you can opt for `/COPY:ATSOU` instead!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions