Copy link to clipboard
Copied
I am working on a graduation magazine showing all of the graduating seniors for a school district. Sometimes I am provided the photos with the filename being the students last name then their first, and this is great as I have to alphabetize them. But sometimes the names are listed as First then last name and in previous years I would manually rename the files and it takes forever.
I was hoping there was a way to do a batch rename where it would flip the words in the filename. For example I have the name John Doe. I want to renamed it to Doe John. Then to rename all files in the folder in this same format.
I have searched and searched and I can not find a way it can be done. I am hoping someone has a solution as I don't want to spend the day renaming hundreds of files manually.
Thank you
Use an app like Excel to fix the incoming data and then do your batch rename.
@Jay2314322751rj – Assuming that you only have a first + last name separated by a single space, the following regular expression string substitution will do the job. Hyphenated names and three-word names may or may not be OK, you need to know and double-check your data:
Find:
(^.+)(?: )(.+)(\.[^\.]+$)
Replace:
$2 $1$3
Of course, the regular expression may need to be more advanced, taking in less simple/common names:
https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch04s18.html
...Copy link to clipboard
Copied
Use an app like Excel to fix the incoming data and then do your batch rename.
Copy link to clipboard
Copied
I managed to make it all work and using Excel was a big help. Thank you
Copy link to clipboard
Copied
@Jay2314322751rj – Assuming that you only have a first + last name separated by a single space, the following regular expression string substitution will do the job. Hyphenated names and three-word names may or may not be OK, you need to know and double-check your data:
Find:
(^.+)(?: )(.+)(\.[^\.]+$)
Replace:
$2 $1$3
Of course, the regular expression may need to be more advanced, taking in less simple/common names:
https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch04s18.html
^(.+?) ([^\s,]+)(,? (?:[JS]r\.?|III?|IV))?$
$2, $1$3
Copy link to clipboard
Copied
@Jay2314322751rj – so how did you go with my suggestion to use a regular expression based batch rename?
Copy link to clipboard
Copied
This helped thank you. I ended up going a bit further though and using scripts Excel and data merge to flow in my photos and names into my document. I did use those "codes" for a lack of a better word to flip the copy though. Thank you