How to Batch-Rename Files Using a Spreadsheet?

I have:

  • Thousands of files in a specific folder
  • The current names of those files in a Google Document
  • The new names I would like them renamed to in the same Document, one column to its right

I would like to search my folder for each filename (from my GoDoc's current filename column), copy the name of the new name it needs to changed to, and rename it in the folder. It would be nice to move the file to a new folder as well.

I think I can put together a set of macros that would take care of the job crudely using simple commands, but it would be prone to error. I would like to take advantage of the Move or Rename file macro. I just don't understand how to use it. I did find 2 examples from this forum, but as a layman, it's hard to understand what's going on with it.

Example I found (but it doesn't do quite what I'm after): Rename File

Any help would be very appreciated.

Thank you!
Bret

For those two reasons (assuming the thousands of files are very important and that you are not that confident with writing your own Macros) I would suggest you go looking for a dedicated file renaming App that will allow you to preview any renaming before you do damage. I'm also guessing that the renaming must be following some sort of pattern (by the fact that you say there are thousands to rename). I love using Keyboard Maestro to solve problems and to automate tasks but for renaming lots of files I would always use a dedicated App. The one I use is A Better Finder Rename but I am sure others here can recommend their favorites.

1 Like

Thank you very much for the information, Zabobon. It looks like the app modifies the current filename. My filenames are going to be completely altered without any kind of pattern.

There are some words that will remain, but I need an app or script that can read a database of names to replace the old names with [i.e. feed it a csv (with 2 columns: new-names and old-names), drag the thousands of old-name files into the app, and let it run.] Is that possible with A Better Finder Rename?

This should work:

I read through all of the documentation and tried to use it, and I believe I understand how it's working. But in its current state, I'm unable to use it.

It looks for an ID at the start of the filename, references the Excel document for a column in A using the same ID, and then renames the file based on everything from Columns B:ZZ.

However, I don't have ID's at the start of my filenames. The only way I could make it work is if I added an ID at the start of the filename, and used the same ID in the excel doc. Then it worked. But I can't see a practical and safe way of renaming 10,000 files using ID prefixes.

The script is fairly short. Is there anyway it could be edited to reference for the entire filename instead an ID prefix in the filename? I need it to look for the entire filename instead of just a number at the start of the filename.

Yes, ABFR can rename files based on the contents of a database. I used to use ABFR a lot but never that feature, so I can't say how easy/effective it is.

The rename app I use all the time now is Name Mangler. The reason I switched to it is its incredible (and I mean incredible) speed. Unfortunately, it doesn't have the ability to rename using a database.

3 Likes

Hey Tiffle,

I did end up purchasing ABFR and a trial of Excel in an attempt to make use of JMichael's script.

It sounds like I have a few options:

  1. Use ABFR to add a sequential numbering as a prefix. Add the same prefix in Excel. Use JMichael's script.

  2. Use ABFR to rename based on a database. I haven't seen this feature yet, but I'll definitely look into it. It sounds like this would be the best option.

1 Like

A Better Finder Rename is exactly what I was looking for. It works perfectly. Thank you all for your help! :hugs:

2 Likes

Hey Bret,

I'm glad to see ABFR is working for you.

I own licenses for both it and Name Mangler, and while Name Mangler is my primary rename tool these days ABFR comes in really handy now and then.

If I was going to build a macro for this I would use BBEdit rather than Excel.

I recommend BBEdit because:

  • Although BBEdit is a commercial product, the trial version reverts to a
    still very powerful and free “Lite” version after 30 days.
  • It is very Mac-like.
  • It has excellent support for RegEx.
  • It is very AppleScriptable.
  • It has a two versatile command line tools.
  • It has been in continuous development for over 25 years.

So – you don't have to buy a copy to use BBEdit for the job – you can use the lite version.

When I have more time I'll probably post an example macro.

-Chris

2 Likes

Thanks for the comment, Chris. I'll look into Name Mangler as well for general use.

1 Like