Windows Batch Renaming

hoppa

Senior member
Apr 10, 2004
253
0
0
I've been fooling around with the Windows "for" command to try to get some effective batch renaming going but am coming up short. Basically, I have a folder of files w/ extensions .jpg.jpg and want to change them all to just .jpg . I know in unix this would be mv *.jpg *, but with windows I've found no such luck. Something like:

for %I in (*.jpg) do rename %I.jpg %I

doesn't actually work because %I takes on the whole filename INCLUDING the .jpg in *.jpg . Any ideas?

I know other software can do this kind of stuff but it would be nice to be able to do it command line. *

-andy


*On that note, can anyone recommend a good FREE batch file renamer with wildcards
 

Geforcer

Member
Sep 19, 2004
178
0
0
I don't know a whole about scripting, but I'm pretty sure if you put something like this should work:

"ren *.jpg *."

removing the last set of .jpg, and still leaving the first .jpg. If it was a quick fix your looking for, this should work for you. ;)
 

hoppa

Senior member
Apr 10, 2004
253
0
0
Hmm, interesting. Yeah that works... why is it that ren *.jpg *. works and ren *.jpg * doesnt? What does that last dot do?

Thanks,
-andy
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
The dot is special in Windows terms since Windows was originally designed with the idea that every file with be named with an extension to determine what type of file it is. These days the extension is less important, but Windows still treats it specially.

And 'mv *.jpg *' wouldn't work on unix, at least none that I know of. But most perl distributions come with a rename script that accepts regular expressions, it's probably the best rename tool ever if you can actually figure out regexps.
 

nweaver

Diamond Member
Jan 21, 2001
6,813
1
0
can't remember where I got it...but there is a program (freeware) called Bulk Raname Utility that is really nice for this. It allows lots of options and such, I like it, saved me from writing a perl script to do it....