rename files from a list

staney

Honorable
Jul 2, 2017
61
1
10,565
Hi guys,
does anyone know of an easy way or bit of software that can rename all the files in a folder from a list?

For example, i have loads of pics that are all named by the camera things like DSCF0995, DSCF0996, DSCF0997 etc and i'd like to be able to rename them "mum and dad", "xmas 2016", "Linda and Joyce" respectively. I have a text file of what names go where, but its a PITA to copy and paste one by one.

I already use Bulk rename utility, but while extremely useful, that can only change ALL the files to the same with minor differences like prefixed numbers etc, whereas all my files have completely different names.

I've seen software that can do the opposite - make a list of file names in a folder, so is there a piece of kit that works the other way round?

Thanks in advance.
 
Solution
How will the program know what to rename the pictures since it won't know what the picture is outside of the name? You would have to have a list of all the files in one row, all the names you want in another row matched up.

A very simple thing I use is Excel and txt documents.

One row in excel is the old name followed by a space. Next row is the command you want to do (in your case "rename") followed by a space, then the next row you will have the new file name. Copy the sheet contents and paste it into a text file. Rename the text file as a .bat file, and run it. Keep in mind that you may need to add in folder paths in there as well if they are not in the same directory.
How will the program know what to rename the pictures since it won't know what the picture is outside of the name? You would have to have a list of all the files in one row, all the names you want in another row matched up.

A very simple thing I use is Excel and txt documents.

One row in excel is the old name followed by a space. Next row is the command you want to do (in your case "rename") followed by a space, then the next row you will have the new file name. Copy the sheet contents and paste it into a text file. Rename the text file as a .bat file, and run it. Keep in mind that you may need to add in folder paths in there as well if they are not in the same directory.
 
Solution


Yes any spreadsheet will do.

I have not done a lot of basic stuff in a while, but use this reference a lot to browse and read through https://blogs.technet.microsoft.com/heyscriptingguy/ It's more for advanced scripting though not just basic DOS batch files.

There is a command reference here https://technet.microsoft.com/en-us/library/bb490869.aspx, you want to go down to the R and look at the rename stuff.
 

staney

Honorable
Jul 2, 2017
61
1
10,565
ok i'll quickly update this in case anyone gets here from a web search.
the way I got this to work after lots of trial and error was this:
in the spreadsheet it should be 1st row "rename (and a space)" 2nd "<original filename (and a space)>" 3rd "<new filename>"

the new filename needs to have "." instead of spaces
new filename has to have correct extension at the end, so a picture would be "Linda.and.Joyce.jpg" using above file as an example, otherwise windows doesn't know what the file is. I had lots of fun learning how to append .jpg to my list!

These may seem obvious to an experienced user, so I thought I'd point them out for the newbies to .bat files like myself.

Thanks again hang-the-9 for pointing me in the right direction.
 


You are right in the command order, I tend to reply at work so usually have several things in my head and mixed up the order the rename command. If you wanted to append the .jpg you can do so in the spreadsheet also, just open it up and put a .jpg in the row after the file name, then drag it all the way down to the end of the list. When you copy that to the text file you will see all of them will have a .jpg at the end.
 

staney

Honorable
Jul 2, 2017
61
1
10,565
Thanks again, that's good to know. I used find and replace command in open office and ".*" replace with ".jpg" (which did seem very long-winded TBH.
Another example of something so obvious I would never have thought of it! lol
 

staney

Honorable
Jul 2, 2017
61
1
10,565
ok, another quick update with some more things I found out playing around all day yesterday.
Original filenames have to have "." instead of spaces as well, and the new file names really don't like things like $*&\ , etc. I couldn't get the extension to work by putting it in the last row either, so went back to adding it at the end of the filename with OO writer.

In the end I could have spent 20 minutes copy and pasting every file but instead I spent about 5 hours playing about with this script. But I do feel extremely proud of myself learning this new skill so actually it was time well spent in my opinion.
Thanks again hang-the-9