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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s