Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to copy the directory itself, not only the contents.

For example I have


I want to copy DirA into DirB so that I have


Here's what I've tried

copy C:\DirA C:\DirB
xcopy C:\DirA C:\DirB /e /s

But whatever I try to do, DirA gets left out


Note: I have a list of directories I want to copy, so I don't know the directory name beforehand and I can't afford to run a heavyweight program like robocopy 1,000 times.

share|improve this question

Try Powershell's Copy-item:

copy-item C:\DirA -Destination C:\DirB -Recurse


cp C:\DirA -Destination C:\DirB -Recurse

share|improve this answer
The Linux cp command also functions as an alias for copy-item. – Davidw Aug 13 '13 at 4:41

Easiest way would be:

xcopy C:\DirA\* C:\DirB\DirA /e /s

Or say your had the folder set as var %foo% in a batch for script

xcopy C:\%foo%\* C:\DirB\%foo%\ /e /s


Also if you are happy to use powershell over Command Prompt

Copy-Item c:\DirA c:\DirB -recurse

share|improve this answer
So I have to explicitly specify the source root folder name in the target path as well? Does Windows not have an equivalent to linux's copy -R /mypath /another_existing_path ? – David Aug 13 '13 at 4:21
Not that I know of from cmd - for reference copy xcopy robocopy – 50-3 Aug 13 '13 at 4:31
Powershell does. – Davidw Aug 13 '13 at 4:32
David beat me to it Copy-Item c:\DirA c:\DirB -recurse – 50-3 Aug 13 '13 at 4:37
Ah, I just posted that as an answer. – Davidw Aug 13 '13 at 4:38

Your Answer


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.