Yes, by way of an Automator Quick Action (service) where you right-click on a folder, and choose Quick Action ▸ Quick Action name. For example, I have right-clicked on a folder named Jon Jones:
I gave the Quick Action an arbitrary name, and you certainly can make it shorter if you wish.
- Launch Automator
- New Document. Quick Action. Choose.
- Set the top part of the Quick Action panel to the following:
- From the Library : Utilities, drag and drop the Run AppleScript action onto the right-hand workflow window
- Open a new line above the on run handler to include use scripting additions
- Replace this line (* Your script goes here *) with the following code
set folder_name to (input as text) as alias
tell application "Finder"
set the folder_list to (every item of folder folder_name) as alias list
if folder_list = {} then return
repeat with afile in folder_list
set afile's name to (folder_name's name) & space & afile's name
end repeat
end tell
Click the compile (hammer) icon in the Run AppleScript Action, and then save the Quick Action with your own unique name for it. Quit Automator, right-click on your target folder, and use the first image menu structure to apply your Quick Action. The Automator Quick Action should look like the following when done:
This was tested on Mojave 10.14.6 (18G6042).