Need a script to edit filenames of all files in a folder.

fuzzybabybunny

Moderator<br>Digital & Video Cameras
Moderator
Jan 2, 2006
10,455
35
91
I need a script to edit all the filenames of all the files in a folder.

pic1 -> a
pic2 -> b
pic3 -> c
and so on (I don't think I'll be going past pic10 - j )

ex.

bedroom-1-pic1.jpg becomes bedroom-1-a.jpg

I have no idea how to create a script :(

Is there a way to make it so that all I have to do is copy the script file into a directory, and run it by double clicking it? No cli or anything.
 

fuzzybabybunny

Moderator<br>Digital & Video Cameras
Moderator
Jan 2, 2006
10,455
35
91
Windows 7.

I just realized that there's probably going to be a few kinks to work out.

Ex.

I set rules for "pic1" = a, "pic11" = k

But when it comes to bedroom-1-pic11.jpg, wouldn't it just change it to bedroom-1-a1.jpg? It would find the "pic1" portion in "pic11" and then just turn it into "pica1"

I'm open to any programs that can already readily do this. I've tried File Monkey, but it blows up after pic10, pic11, etc.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
Only if you use "pic1" instead of "pic1." in your substring.

I have no idea what program to tell you to use though, my Linux installation has the 'rename' script that comes with perl which lets me use any replacement regexp to rename files.
 

CycloWizard

Lifer
Sep 10, 2001
12,348
1
81
This is very straightforward to do in MATLAB, though I haven't done it in any other language. I'm sure any common language should have rename functionality that should be almost trivial to script to do what you're looking for, but if you don't want to script it, there are also programs that you can download. The one that I recall using back in the day was Batch File Renamer, though it's been a long time so I don't know if it will work with newer file systems (though I don't see why it wouldn't).