Copy files within a directory structure to another directory, leaving the directories behind

posted 5 Aug 2015, 03:22 by Tristan Self
I had an interesting request, how to move a load of PDF files from one directory structure to another but leaving behind that directory structure so all the files end up in one directory in a huge list. I thought XCopy, but this appeared to be a better way.

forfiles /p c:\source\ /M *.pdf /S /C "cmd /c copy @file c:\destination"

Note: Files with the duplicate names are just overwritten.