• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Batch Rename Alphabetical listing of names

Community Beginner ,
Apr 30, 2022 Apr 30, 2022

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

TOPICS
Batch , How to , Problem or error

Views

155

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

LEGEND , May 02, 2022 May 02, 2022

Use an app like Excel to fix the incoming data and then do your batch rename.

Votes

Translate

Translate
Community Expert , May 03, 2022 May 03, 2022

@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

 

 

 

swap-names.png

 

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

...

Votes

Translate

Translate
LEGEND ,
May 02, 2022 May 02, 2022

Copy link to clipboard

Copied

Use an app like Excel to fix the incoming data and then do your batch rename.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

LATEST

I managed to make it all work and using Excel was a big help. Thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2022 May 03, 2022

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

 

 

 

swap-names.png

 

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2022 May 08, 2022

Copy link to clipboard

Copied

@Jay2314322751rj – so how did you go with my suggestion to use a regular expression based batch rename?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2022 May 08, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines