Linux-Noob Forums
Copy *.whatever from wherever into ONE directory - Printable Version

+- Linux-Noob Forums (
+-- Forum: Windows Noob (
+--- Forum: Tips and Tricks (
+--- Thread: Copy *.whatever from wherever into ONE directory (/thread-3863.html)

Copy *.whatever from wherever into ONE directory - Digerati - 2003-12-19

A question arose today on how to copy all the jpg's from all over one computer to one single directory. Well here is one way to automate this task.

First do this:


DIR /b/s *.jpg>list.txt


Now after the command has complete its run, open the file in notepad.

Now use it's search/replace feature to replace all occurrences of the drive

letter with the copy command...



With:COPY /Y C:\



If any filenames in the list contain spaces, add a double quote in front of

the drive letter like this...


With:COPY /Y "C:\



Then using a case insensitive search, replace all occurrences of the ".jpg"

extension with the remainder of the command.


With:.jpg c:\jpeg_files


If you added a double quote above, then you will need to add one following

the .jpg extension to enclose each file name in double quotes.


With:.jpg" c:\jpeg_files


Now review the file to ensure you see each command as follows,


COPY /y C:\pathname\filename.jpg c:\jpeg_files


Or with double quotes,


COPY /y "C:\pathname\filename.jpg" c:\jpeg_files


If all looks good, save it as somefile.bat and run it.


The possibilities with this script are not limited to just that.

You could also replace the COPY command with the DEL command to delete, or the MOVE command to move it from its current location.