Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

How do I copy all the files in a folder and all of the files in its subfolders to a single folder on XP?

share|improve this question
up vote 12 down vote accepted

Assuming the names are all unique, you should be able to use this command (command group really):

for /f "tokens=*" %a in ('dir /b /s /a-d') do @copy "%a" "c:\Single-Folder"

To clarify - open a Command Prompt and in the root folder of the folder with the sub folders you want to copy, run that command. So, for example, if you want to copy everything in "C:\Sample Folder Tree" and all its sub directories, you could change into "C:\Sample Folder Tree" from the command prompt and then run that command.

Or, you could just specify it in the dir section like this:

for /f "tokens=*" %a in ('dir /b /s /a-d "c:\Sample Folder Tree"') do @copy "%a" "c:\Single-Folder"

If you want to see what this will do without it actually doing anything, add an "@echo" between the do and copy - like so:

for /f "tokens=*" %a in ('dir /b /s /a-d "c:\Sample Folder Tree"') do @echo copy "%a" "c:\Single-Folder"
share|improve this answer
Or one could do for /r %a in ("C:\Path\To\Source\*") do @copy "%i" "C:\Path\To\Output" instead of for /f – afrazier May 4 '10 at 1:29
 robocopy c:/here c:/there/ /S /COPYALL

That works. It needs administration cmd unless you dont want /copyall (which copies permissions and i think timestamps instead of creating new timestamps).

theres a robocopy for XP and available on vista and Windows 7. copy works fine enough tho. I like robocopy bc it wont recopy the same files if the dest has a copy (lets say you get interrupted like a power outage or want to shutdown and sleep)

share|improve this answer

You could use the disk cataloguing utility SuperCat.

share|improve this answer
It is not free (except as a Trial version) and seems may not copy files, however useful in other respects. – pnuts Dec 2 '12 at 22:13

You must log in to answer this question.

protected by Community Sep 20 '11 at 7:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .