I want to copy all files of a certain type (like .docx, .pdf, etc) on my PC into a folder. How can I do that?
Perhaps the simplest option is to use Windows Search from whichever drive you wish to copy the files from (or from My Computer if you want to find them across all of your drives). Type *.pdf into the search field at the top right of an Explorer window. Once it finishes finding everything, press Ctrl+a, then Ctrl+c. Navigate to your destination folder, then Ctrl+v. This will allow you to have all of the files in that one directory (no subdirectories).
Another option is Robust Copy (robocopy), which will create a mirrored folder structure of the files it finds into the destination folder:
robocopy C:\ C:\OutputFolder *.pdf /S /R:1 /W:1 /NDL /XJD /XD OutputFolder /L
If your PC does not have this command, it is available as part of the Windows 2003 Server Resource Kit here.
C:\OutputFolder accordingly to whatever directory you want. A quick overview of what these options are doing:
- C:\ this is the source that is to be searched.
- C:\OutputFolder this is the destination into which the files will be copied.
- /L will LIST all the files that will be copied; the command won't actually copy anything with this option present. This way you can review the files that will be copied, how many there are, total size, etc. To allow the files to be created, simply re-run the command without /L.
- /S recurses all subdirectories under the provided source, "C:\".
- /R:1 (optional) will retry any failed copy events once.
- /W:1 (optional) will wait one second after an event fails.
- /NDL (optional) will prevent directories from being listed.
- /XJD (required) will prevent Directory Junction Points from being parsed. This avoids a nasty recursion issue that can sometimes occur with Windows' "fake" directories such as "Documents and Settings".
- /XD OutputFolder (required) will prevent Robocopy from re-copying files that have already been placed into your OutputFolder.