Rename client folders

Joined
Dec 6, 2020
Messages
7
Reaction score
0
Hi all

First of all thank you for any help you might be able to offer.

I'm looking at renaming a few hundred customer folders. They are currently formatted [FIRST NAME] [LAST NAME] and I would like to see if there is a way to rename these as [LAST NAME] [FIRST NAME]

Is this possible with macOS 11 itself, or could someone recommend an application which could help (hopefully free)

Thanks again :)

Edit : files to folders!
 
Last edited:
Joined
Nov 9, 2020
Messages
187
Reaction score
4
Couple of questions, along with a "warning" per se:

1. What types of files are these? That is, what application (or applications) was used to create such information?
2. Are you making backups to an external device? If so, what program do you use for that? And how often do you make backups?
3. Form what I can tell, you are using Big Sur. If so, what Mac OS did you upgrade from?
4. Warning: Big Sur is not that stable yet. As it is, V11.1 will be arriving shortly. Hence, that is why a backup is so, so critical (actually no matter what mac OS you use).
 
Joined
Dec 6, 2020
Messages
7
Reaction score
0
Couple of questions, along with a "warning" per se:

1. What types of files are these? That is, what application (or applications) was used to create such information?
2. Are you making backups to an external device? If so, what program do you use for that? And how often do you make backups?
3. Form what I can tell, you are using Big Sur. If so, what Mac OS did you upgrade from?
4. Warning: Big Sur is not that stable yet. As it is, V11.1 will be arriving shortly. Hence, that is why a backup is so, so critical (actually no matter what mac OS you use).
Thanks for the reply.

1 Theses are folders.

2 I have them backed up in iCloud/Time Machine and a NAS as well.

3 Not having any issues with Big Sur, clean install
 
Joined
Nov 9, 2020
Messages
187
Reaction score
4
Thanks for the reply.

1 Theses are folders.

2 I have them backed up in iCloud/Time Machine and a NAS as well.

3 Not having any issues with Big Sur, clean install
Cool:

This link can help, although I am assuming the same method works with Big Sur:

 
Joined
Dec 6, 2020
Messages
7
Reaction score
0
Last edited:
Joined
Nov 14, 2012
Messages
2,241
Reaction score
100
Hi,

It’s changing first to surname etc. Looks like an individual process.
 
Joined
Nov 14, 2012
Messages
2,241
Reaction score
100
Hi,

No I feel if Automator was given the correct code then maybe that would do the job for you, but I very rarely use it so can’t help there.
 
Joined
Dec 6, 2020
Messages
7
Reaction score
0
Here's a way to do it...

Thank you so much slumber over at talk.automators.fm :)

IMPORTANT: Backup your customer directories before doing this.

You always want to be able to undo or restore it just in case something does not meet your needs.

This approach just uses built in command line utilities.

Open the terminal app and cd to the directory holding your customer folders. This is a vital step. Make sure you run this command exactly where you need to.

Enter the following line:

Copy to clipboard
ls -d * | sed -n 's/\(.*\) \(.*\)/mv "\1 \2" "\2 \1"/p' | sh

The first part, before the first pipe, lists the directories.

The second part uses the stream editor (sed) and some regular expressions to build some move (mv) commands. One for each directory.

e.g. mv "john smith" "smith john"

The final part simple shell executes the commands generated.

To see the commands to be executed without executing them just remove the “ | sh” from the end of the command. That’s a good double check before running it.

One useful thing to note is that this renaming, if run a second time, should reverse the effects if all of the folder names were in the correct initial format.

Hope that helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top