Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to replicate the folder structure from a location in another location. Also, I want only the structure which is one level deep to be replicated. Is there a way to do it?

I'm running Windows 7 Professional 64 bit.

share|improve this question

migrated from stackoverflow.com Dec 15 '10 at 11:22

This question came from our site for professional and enthusiast programmers.

    
Are you looking for a tool that does that or you need to implement that? –  detunized Dec 2 '10 at 20:35
    
a tool, I guess that makes this question more relevant to superuser? Could someone move it? –  Pulkit Sinha Dec 2 '10 at 21:14

5 Answers 5

up vote 8 down vote accepted

You can use XXCOPY with the /T and /DL switches.

/DL Limits processing of directory nesting to n levels.

/T Creates directory structure, but does not copy files. It copies all directories including empty ones

http://www.xxcopy.com

share|improve this answer

From a command prompt:

cd C:\Path\To\Source
for /d %i in (*) do @md "C:\Path\To\Destination\%i"

Make sure to quote the destination path to take into account any folders with spaces in the name.

share|improve this answer

If you don't want to use third party programs, the windows 7 native XCOPY command can also duplicate a folder structure.

xcopy source dest /t /e

will create the directory structure including empty folder but without copying the files.

share|improve this answer

Check free Windows tool, 47folders, it was made for it!

share|improve this answer

Robocopy supercedes/replaces xcopy in Windows 7, and allows limiting copies to N folder levels deep, e.g.:

robocopy <source> <dest> /e /create /lev:2
  • /e includes subfolders, even if empty (use /s instead to exclude empty folders)

  • /create only copies the folder structure and zero-length files

  • /lev:N limits subfolder traversal to N levels, including the <source> folder you specified... so /lev:1 would only include the <source> folder itself, and /lev:2 includes any subfolders immediately under <source>, but not their subfolders, and so on

See http://technet.microsoft.com/en-us/library/cc733145.aspx for details.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.