Jump to content
Sign in to follow this  
Digerati

Copy *.whatever from wherever into ONE directory

Recommended Posts

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...

 

Replace:C:\

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.

Replace:.jpg

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.

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...