Gather similar files from multiple folders and copy them in one simple step
Ka3ebe asked the Utilities forum for a way to copy all of the .txt or .jpg files on a computer to a particular folder.
I’ve got two ways to do this. One uses familiar, Windows-based drag and drop methods. The other harkens back to the dark days of DOS, but it still works in all versions of Windows.
[Email your tech questions to firstname.lastname@example.org.]
And the difference isn’t only one of user interface. The drag-and-drop method will put all of the files in the same folder. The DOS-like command line approach will preserve the folder structure of the original source. In other words, if you’re copying these files to D:\mydocs, the first method will place every file in the D:\mydocs folder; the second method will place the files in subfolders of D:\mydocs.
Let’s start with the drag-and-drop method: Using Windows Explorer (or File Explorer in Windows 8), navigate to your root location—the drive or folder containing all of the files you want to grab. That might be your Documents folder, or it might be C:. Once there, click the search field in the upper-right corner and type your search criteria. If you want to copy all files with a particular extension, type *., followed by that extension. For instance,
Windows (File) Explorer will then display every file with that extension in your current location and its subfolders. Once the files are visible, press Ctrl-A to select all of them, then drag and drop them to the right location. (If you want to copy the files to another folder on the same drive, remember to hold down Ctrl while you drag and drop; see The many ways to copy, move, or delete multiple files for details.)
If you want to keep the copied files in their folder structure, you should use this command-line trick:
In Windows (File) Explorer, Shift-right-click the root location (such as C: or My Documents) and select Open command window here. This will bring up a black command-line environment that may seem nostalgic if you’ve been computing for more than 20 years.
Once there, type the command:
xcopy *.ext destination
where ext identifies the type of file you want to copy, and destination where you want it copied to. For instance, to copy all of your *.docx files to D:\alldocx, type
xcopy *.docx d:\alldocx /s.
This technique, unlike the others, will maintain the folder structure as it copies the files.
Read the original forum discussion.