Rename File from Parent Folder Name

I have tried and at this point I think I have just confused myself. I am trying to rename a File to the name of the Parent Folder. I am lost and confused.

Example:
File = smb://synergy.local/Media/Servers/AudioServer/JJonJimmy - Let Me Cry/B9A7A83752D9EF25.mp4

How can I dynamically select a file from Finder and hit a hotkey and have it rename the file as such:
Rename the file B9A7A83752D9EF25.mp4 == JJonJimmy - Let Me Cry.mp4

I figured out how to manipulate the file to add the extension but everything i try to only pull the parent folder name fails.

Thanks
gm

How were you trying to pull the parent folder name? At any rate, this worked for me:

Rename File to Parent Folder.kmmacros (2.4 KB)
image

2 Likes

Hi guys

this is a fantastic and useful idea!
I have very limited technical skills but @gglick, can this be modified to work on more than 1 file and add a sequential number (ie 001,002 etc)? Currently if I select 2 or more files it gives an error that the file name exists?

thx a lot

best

Z

Sure can:

Rename Multiple Files to Parent Folder.kmmacros (6.5 KB)

EPIC!

thx so much @gglick, this will be super useful :smile:

Z

1 Like

Hey @gglick

How could this give a dialog to input a new name rather than pulling from the Folder's name?

Thanks!

No need to reinvent the wheel for that. Peter himself covered that use case nicely years ago: Batch Rename files in the Finder

In fact, I think it's even in KM's Macro Library by default:

59%20AM

Hey guys, in the future, please start a new topic for a new question, especially if you were NOT the OP. If the new question is closely related, just click on the link icon at the bottom of the post to open a new topic with a link to the original topic/post:

image

The benefits of doing this are:

  • Allows the asker of each question to select the best post for its solution
  • If the new question raises more questions and/or is more complex than you thought, it keeps all of the discussion together without distracting from the OP.

Thanks.

1 Like

thx @JMichaelTX, makes a lot of sense, will do!

best

Z

Very nice! Thanks for the training! Will do going forward.