Use Automator to get selected finder items filename

I am having trouble getting just the file name as a variable. Choosing a file using "Ask For finder item" gives the full path. Using the Variable I want to rename another file with the name picked up from "ask for finder item" step

any help would be great thanks

BTW im using Big Sur

Posted on Mar 12, 2021 8:14 PM

Reply

Similar questions

5 replies

Mar 13, 2021 9:56 AM in response to John H

IMHO the only practical way to do this is via AppleScript.

Automator's variable handling is seriously cumbersome.


If you want to run this within automator, here's one way to do it:



This workflow asks the user for two files - the file whose name we want, and the file to rename.


These then both get passed into a Run AppleScript action which extracts the file name from the first item and instructs the Finder to rename the second item.


Note that it incorporates a try block since there may be cases where the rename fails (duplicate file name, locked volume, etc.)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Use Automator to get selected finder items filename

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.