Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

regis4u

macrumors newbie
Original poster
Sep 17, 2007
12
0
I'm not a coder and have a basic understanding of coding which is why I'm using Automator.

I created an Automator application that renames a file by removing a specified word and I can select a batch of files and drop them on the application to perform this task.

Basically, I get files that will have a random file name followed by a username in parenthesis (ex: "file name (jsmith).docx"). The task(s) I've created will find the username (so in my example, " (jsmith)") and then remove it, leaving the file name as "file name.docx".

The problem is that I've added so many Rename Finder Item tasks that the application has become bloated and takes forever to open or even run the tasks when files are dropped on the app.

I'm sure there is a more efficient way to do this, I'm just not sure how to go about it. I don't think there is a task in automator where I could keep a collection of usernames I want to remove or another option would be to reference a plain text file that has all of the usernames.

If I posted this in the wrong area, please let me know and I will repost elsewhere.

Any help would be appreciated.

Thanks!
 
You don't need to script this. Finder can already do that. Batch select the files you want to modify, then right click and select "Rename..."
 
Thanks for the response. I'm familiar with selecting a group of files and using rename.

The problem is that I have a bunch of different usernames I want to delete from file names and its time consuming to just select files with one username, remove that name than do that with the other files that have different usernames.

The application I created does what I want but I've added so many usernames in individual file rename tasks and now when I want to add new usernames, the application takes a long time to open to make those additions.
 
You should really look into using the Terminal for such tasks. It takes a bit of getting used to, but once you know the basics of the Unix shell something like what you are trying to do becomes relatively easy.
 
I created mine long time ago long before Finder have batch rename. I used automator. Use workflow file when open first time and screenshot show mine. I drag files into 'Get Specified Finder Item's box or can just use 'Add' button. Then add how you want your files be renamed etc and and run it (Look at top right corner). It will rename files in same place where you saved them. Hope it helps?

It won't be same you wanted but maybe give idea??
 

Attachments

  • Screenshot 2023-01-17 at 1.48.53 pm.png
    Screenshot 2023-01-17 at 1.48.53 pm.png
    903.4 KB · Views: 190
Basically, I get files that will have a random file name followed by a username in parenthesis (ex: "file name (jsmith).docx"). The task(s) I've created will find the username (so in my example, " (jsmith)") and then remove it, leaving the file name as "file name.docx".
I mentioned the terminal, here's how to achieve this with a single command once you've got everything installed:
Code:
$ brew install rename

$ rename -n 's/ \(.*\)//' *.jpeg
'bla bla (john doe).jpeg' would be renamed to 'bla bla.jpeg'
'foo foo (jane doe).jpeg' would be renamed to 'foo foo.jpeg'
 
  • Like
Reactions: Slartibart
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.