Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

HelplessOne1

macrumors newbie
Original poster
Jan 4, 2023
4
2
Is there a way to automate this?

I want to select the Parent Folder and have the automation append the name of the container folder to the beginning of the sub folders. See me screenshots attached of a before/after demo.

Screen Shot 2023-01-03 at 3.04.56 PM.png


TO

Screen Shot 2023-01-03 at 3.05.36 PM.png


I have little background knowledge on this, but I would imagine there is some way to create a Quick Action or workflow in Automator, no? Thanks!
 

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
Automator – QuickAction – AppleScript
Code:
on run {input, parameters}
    tell application "Finder"
        set theFolders to input
        repeat with currentFolder in theFolders
            set theFolderName to displayed name of (container of currentFolder)
            set currentFolderName to displayed name of currentFolder
            set name of currentFolder to (theFolderName & " " & currentFolderName)
        end repeat
    end tell
end run
Input - Folders from Finder, save as Rename folders or whatever you like. Select the 1,2 .. folders in Finder, right-click, QuickAction - Rename Folders

Similar question and solution for files https://forums.macrumors.com/threads/batch-rename-of-files-to-folder-names.2365694/
 

HelplessOne1

macrumors newbie
Original poster
Jan 4, 2023
4
2
Automator – QuickAction – AppleScript
Code:
on run {input, parameters}
    tell application "Finder"
        set theFolders to input
        repeat with currentFolder in theFolders
            set theFolderName to displayed name of (container of currentFolder)
            set currentFolderName to displayed name of currentFolder
            set name of currentFolder to (theFolderName & " " & currentFolderName)
        end repeat
    end tell
end run
Input - Folders from Finder, save as Rename folders or whatever you like. Select the 1,2 .. folders in Finder, right-click, QuickAction - Rename Folders

Similar question and solution for files https://forums.macrumors.com/threads/batch-rename-of-files-to-folder-names.2365694/
This worked like a charm! Thanks so much!!

Just for fun- is there a way to select A, B, C and run a script that way? If not, I can work with this!!! Such a time saver. :)
 

HelplessOne1

macrumors newbie
Original poster
Jan 4, 2023
4
2
Download Abode Bridge, pretty sure it is free without the rest of the Adobe cloud apps.
It has a renaming feature which will rename nested files based on the parent folder, but maybe not 2 levels deep.
I have bridge, but I wasn't sure how to do what you're talking about. lol!
 
  • Like
Reactions: orionquest

bogdanw

macrumors 603
Mar 10, 2009
5,712
2,749
This worked like a charm! Thanks so much!!

Just for fun- is there a way to select A, B, C and run a script that way? If not, I can work with this!!! Such a time saver. :)
I've only tested it once
Code:
on run {input, parameters}
    tell application "Finder"
        set theFolders to input
        repeat with currentFolder in theFolders
            set subFolders to folders of currentFolder
            repeat with currentSubFolder in subFolders
                set theSubFolderName to displayed name of (container of currentSubFolder)
                set currentSubFolderName to displayed name of currentSubFolder
                set name of currentSubFolder to (theSubFolderName & " " & currentSubFolderName)
            end repeat
        end repeat
    end tell
end run
 
  • Love
Reactions: HelplessOne1

HelplessOne1

macrumors newbie
Original poster
Jan 4, 2023
4
2
I've only tested it once
Code:
on run {input, parameters}
    tell application "Finder"
        set theFolders to input
        repeat with currentFolder in theFolders
            set subFolders to folders of currentFolder
            repeat with currentSubFolder in subFolders
                set theSubFolderName to displayed name of (container of currentSubFolder)
                set currentSubFolderName to displayed name of currentSubFolder
                set name of currentSubFolder to (theSubFolderName & " " & currentSubFolderName)
            end repeat
        end repeat
    end tell
end run
Works on my end! Thanks so much for both incredible solutions!
 
  • Like
Reactions: bogdanw
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.