Ecco una soluzione AppleScript che è abbastanza efficiente. Puoi salvare questo codice in script editor.app come un'applicazione.
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
Sepreferiscicheinomidellecartelleaunasolacifraappaianoaduecifre(01,02,03,ecc.),usainvecelaseguenteversionedelloscript
setnewNameto0settheFolderto(choosefolderwithprompt"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
Questo codice AppleScript seguente rinomina i file nella cartella scelta, invece di rinominare le cartelle.
set newName to 0
set theFolder to (choose folder with prompt "Choose Folder" with invisibles)
tell application "Finder"
set theFiles to files of theFolder
set sortedFiles to sort theFiles by name
repeat with i from 1 to count of sortedFiles
set newName to newName + 1
set thisItem to item i of sortedFiles
set nameExtension to name extension of thisItem
if newName is less than 10 then
set name of thisItem to 0 & newName & "." & nameExtension as string
else
set name of thisItem to newName & "." & nameExtension as string
end if
end repeat
end tell