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.

using DOS, I'd like to copy one directory to another. For example there is directory C:/test and C:/test2.

I'd like to copy C:/test into C:/test2 so that the result will be C:/test2/test

Everything I've found so far will only copy the files and folders contained in C:/test into C:/test2, but leaves out the parent directory.

share|improve this question

migrated from stackoverflow.com Nov 2 '10 at 3:00

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

1  
try to use xcopy –  Sandeep Singh Rawat Nov 1 '10 at 21:53

5 Answers 5

Try using XCOPY with the /E switch. More info here.

I haven't had to access this information from my brain in years!

share|improve this answer
1  
The '/T' switch on Xcopy will do a directory & subdirectory structure copy without any files. –  mfg Nov 9 '10 at 16:33
    
RE: /T switch, that can be extremely useful sometimes. Granted, it does not come up often, but when it does, wow does knowing that trick come in handy! :) –  Bobson Mar 11 '12 at 19:59

xcopy c:\test c:\test2\test /s /e /h

Here is info on XCOPY

share|improve this answer

I recommend robocopy over xcopy, as it has a lot more options, including keeping timestamps intact, which I find essential.

Robocopy needs to be added on XP/2003, but it is standard from Vista onwards.

I actually usually use xxcopy, but the 64-bit version is not free.

share|improve this answer
    
robocopy is a Windows program. The question was about DOS. –  grawity Nov 2 '10 at 20:52
2  
@grawity: The likelihood of him actually using 16-bit DOS is very small compared to the high probability of him calling CMD 'DOS', as is common in the real world. –  paradroid Nov 3 '10 at 8:31
XCOPY SourceDrive: DestinationDrive: /S /E

For example, if you need to copy E: drive data to H: drive (external hard drive) through command line or from xboot command environment.

xboot:\>XCOPY E:\ "H:\BackupFolder\" /S /E
share|improve this answer

This will do that from the GUI, don't know how they do it.

"...small program will allow you to select the "from directory" and "into directory", and it will proceed to copy ONLY the directory structure."

http://www.rjlsoftware.com/software/utility/treecopy/

share|improve this answer

Your Answer

 
discard

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