Ritaglia i primi 6 caratteri dai nomi delle cartelle [AppleScript]

1

Ho trovato un AppleScript online che taglia i primi caratteri da un FILENAME, tuttavia, sembra non funzionare su FOLDERS.

Come potrebbe essere modificato per rinominare i nomi delle cartelle?

set whichFile to choose file with multiple selections allowed
repeat with aFile in whichFile
    tell application "Finder"
        set filename to name of aFile
        set name of aFile to ((characters 7 thru -1 of filename) as string)
    end tell
end repeat

Grazie!

    
posta user76778 26.04.2014 - 22:38
fonte

3 risposte

1

È facile tagliare i primi sei caratteri usando Namechanger .

Mi scuso se hai specificamente bisogno di usare AppleScript, ma Namechanger è un'app utile per rinominare i file e amp; cartelle. Mi ha trattato bene.

Spero che questo aiuti!

    
risposta data 27.04.2014 - 03:59
fonte
1

Questo vale per i file selezionati in Finder e funziona con entrambe le cartelle e i file normali:

tell application "Finder"
    repeat with f in (get selection)
        set name of f to (text 7 thru -1 of (get name of f))
    end repeat
end tell

Potresti anche eseguire un comando come questo in Terminale:

cd ~/containing/folder;for f in *;do mv "$f" "${f:6}";done
    
risposta data 30.04.2014 - 10:51
fonte
0

Prova:

set whichFolder to choose folder with multiple selections allowed
repeat with aFolder in whichFolder
    tell application "Finder"
        set folderName to name of aFolder
        set name of aFolder to (text 7 thru -1 of folderName)
    end tell
end repeat
    
risposta data 27.04.2014 - 19:17
fonte

Leggi altre domande sui tag