重命名批处理文件mac删除第一个单词

时间:2013-05-21 21:08:09

标签: macos automator

我正在尝试在mac上重命名一批文件。

文件看起来像

122试验12.JPG

我需要输出文件为

试验12.JPG

我一直在尝试使用automator,但我不知道自己在做什么。

1 个答案:

答案 0 :(得分:1)

您可以使用AppleScript:

set myFiles to (choose file with multiple selections allowed)
repeat with aFile in myFiles
    set aFile to contents of aFile
    tell application "Finder"
        set fileName to aFile's name
        set firstDash to offset of "-" in fileName
        set aFile's name to text (firstDash + 1) through -1 of fileName
    end tell
end repeat
相关问题