Renaming Files in Folder by Removing Everything but the Name


I am not posting an example because I don't know where to begin.

Files names in my Finder folder look like this:

  • John Smith- jxebj8hn837.xlsx

  • Suzy Chan- p890j9jijj.xlsx


My goal is to rename all of the files to just the name (and file type). So everything before the "-"

Any ideas?

Hey Mike,

Please be more specific...

  • All files in a folder?
  • Only selected files in a folder.
  • Files should remain in place?
  • Etcetera.


Here something simple to start with:

Rename Files [1].kmmacros (6.0 KB)


  1. Set a trigger in the macro header (e.g. a hotkey).
  2. In the first (green) action, set the folder path where your files are located. (You can drag the folder from the Finder into the text field of the action.)

If all file names are structured like your two examples, then this should work.

If there are files with identical names before the hyphen, then the first one is renamed and the other ones are left untouched. The notification tells you about any duplicates.

Unless you have thousands of files, this should be reasonably fast.

As always with potentially destructive actions (Move/Rename), first try the macro on a test folder, and make sure the folder path is correct!

– Tom


Hi Chris!

All files in a folder, files should remain in place.

I had to download about 300 files. I moved the downloaded files to a new folder. I need the files in that folder renamed to remove everything after the "-" and left in the folder.

1 Like

Thank you Tom! I will be giving this a try here shortly.

@Tom It worked flawlessly, thank you.