There are times when you only wish to copy the folder/directory structure and not the files inside of them. For example, you have created a perfect file system for your 2021-2022 financial year and have sorted the files accordingly. Now you want to do the same for 2022-2023. Instead of remaking every folder and subfolder individually, you can copy only the folder structure from one drive to another, or from one folder to another. In this article, we are going to show you how to duplicate a folder structure without the files inside of it. Of course, any sub-directories would also be duplicated.
Copy Folder Structure Without Files in Windows
You can copy the folder structure using both Command Prompt and Windows PowerShell.
Copy Folder Structure Without Files in Windows From Command Prompt XCOPY Robocopy From PowerShell Copy Folder Structure Without Files in MacOS Copy Folder Structure Without Files in Linux Closing Words
If you’d rather prefer to use the Windows Graphical User Interface (GUI), there is currently no native way of doing that in Windows. However, you can use “Duplicate Directory” by Better Editor, but it is a paid utility.
From Command Prompt
XCOPY
XCOPY is a Windows command line tool that is preinstalled in all Windows versions. There are many switches that you can use to manipulate the movement of your files and folders. However, we will only be concerning ourselves with the 2 switches discussed in this table: To copy the structure of a folder from one place to another, the following syntax is used in an elevated Command Prompt: In this cmdlet, replace the following variables:
[SourcePath]: Complete path of the folder that you want to duplicate the structure of. [DestinationPath]: Complete path of the directory where you want to duplicate it.
Here is an example. As you can see in the image below, the folder structure has been duplicated from “C:\Users\subhan\Desktop\TestFolder” to “E:\WorkFolder” without the files. You can also achieve the same with Robocopy.
Robocopy
Robocopy has an even lengthier list of switches than XCOPY, making it more functional. However, we can achieve the same with Robocopy as we did with XCOPY. Here, we will be using the following 2 switches: To copy the structure of a folder from one place to another, the following syntax is used in an elevated Command Prompt: In this cmdlet, replace the following variables:
[SourcePath]: Complete path of the folder that you want to duplicate the structure of. [DestinationPath]: Complete path of the directory where you want to duplicate it.
Here is an example. At the end of the output, you also receive a statistical report of the directory movement, prompting you of the successful and the failed directory copies. Similar to XCOPY, the same folder structure would have now moved from the source to the destination folder.
From PowerShell
You can also copy the structure of a folder onto another location without the files inside using Windows PowerShell. However, this method copies the entire source folder onto the destination directory, instead of the subfolders of the source directory. To explain this better, let’s refer to the XCOPY and Robocopy methods. The folder structure of “TestFolder” was duplicated into “WorkFolder.” However, using the PowerShell method, the entire “TestFolder” directory will be copied into the “WorkFolder” directory without the files. To copy the structure of a folder into another location, use this command in an elevated PowerShell: In this cmdlet, replace the following variables:
[SourcePath]: Complete path of the folder that you want to duplicate the structure of. [DestinationPath]: Complete path of the directory where you want to duplicate it.
Here is an example. Now as you can see in the image below, the entire “TestFolder” has been copied to “WorkFolder,” inside of which is only the directory structure duplicated, and not the files.
Copy Folder Structure Without Files in MacOS
To copy the directory structure without the files on a macOS, you also need to use the Terminal. Follow these steps to duplicate the structure of a folder onto another location on a Mac: This will now move the folder structure from the source folder to the destination location without copying the files inside. Tap the “Launchpad” button and type “Terminal” in the search bar, then open it.
Copy Folder Structure Without Files in Linux
To copy the structure of a folder without the files inside on a Linux platform, use these steps: Your source directory structure will now be copied to the destination directory without the files. Use the CTRL + Alt + T shortcut keys to open the Terminal. Replace [SourcePath] with the complete path of the source folder, and [DestinationPath] with the complete path of the destination folder.
Closing Words
Now everyone just needs to duplicate their folder structures. However, the people who need this know how helpful this feature might be, regardless of your OS platform. Duplicating folder structures can often save minutes, if not hours, and the exact hierarchy can then be used to repeat the documentation and reporting process that you have been using in the past.