How to copy folder structure without files in Windows


If you need to copy directory structures in windows, you need to use Robocopy. Robocopy stands for “Robust file copy.” It’s a standard feature for Windows starting with Vista. It can also be installed in WinXP as part of the Windows Resource Kit.

To use Robocopy to clone a directory without files, use the following syntax in a Command Prompt (cmd.exe):

robocopy "C:\Your Folder" "C:\New Folder" /e /xf *

same as above but without displaying the status:

robocopy "C:\Your Folder" "C:\New Folder" /e /xf * >null

same as above and creates a log (overwrites existing log):

robocopy "C:\Your Folder" "C:\New Folder" /e /xf * /log:yourlogfile.log

same as above and appends to log (appends to existing log):

robocopy "C:\Your Folder" "C:\New Folder" /e /xf * /log+:yourlogfile.log

/e = Copies subdirectories, including empty ones.
/xf = Excludes files matching the specified names or paths.
Wildcards “*” and “?” are accepted.
Additional Robocopy commands can be found here.

Advertisements