Is there a way to batch replace current folder names with increasing numbers? The "Rename Finder Items" built-in feature only lets you replace in the 'Find and replace text' kind of way. Not all my current folder names have common characters. I'm using Mojave, btw.

up vote 4 down vote accepted

Select all the folders you want to rename, right click them and select "Rename [number] Items..."

When you use the "Rename Finder Items" feature, you have to change it from "Replace Text" to "Format" in the drop down menu:

enter image description here

Now you can rename it however you want:

enter image description here

(I'll add better images later)

Here is an AppleScript solution that is quite efficient. You can save this code in script editor.app as an application.

set newName to 0
set theFolder to (choose folder with prompt "Choose Folder" with invisibles)

tell application "Finder"
    set theFolders to folders of theFolder 
    set sortedFolders to sort theFolders by name
    repeat with i from 1 to count of sortedFolders
        set newName to newName + 1
        set thisItem to item i of sortedFolders
        set name of thisItem to newName
    end repeat
end tell

enter image description here

If you would prefer the single digit folder names to appear as double digit (01,02,03 etc.), use this following version of the script instead

set newName to 0
set theFolder to (choose folder with prompt "Choose Folder" with invisibles)

tell application "Finder"
    set theFolders to folders of theFolder
    set sortedFolders to sort theFolders by name
    repeat with i from 1 to count of sortedFolders
        set newName to newName + 1
        set thisItem to item i of sortedFolders
        if newName is less than 10 then
            set name of thisItem to 0 & newName as string
        else
            set name of thisItem to newName
        end if
    end repeat
end tell

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.