1

我有一个完整的截图文件夹,文件名如下:

http_www.mozilla.org.png
http_www.google.com.png

我想删除 www 之前的每个元素。以及 .org 或 .com 之后的每个元素

我应该在mac上的automator中做什么来实现这样的事情?

谢谢

4

1 回答 1

1

如果你想重命名它们,试试这个 AppleScript:

   tell application "Finder" to set myFiles to files of (choose folder)
repeat with aFile in myFiles
    tell application "System Events" to set fileName to aFile's name
    set newName to do shell script "echo " & quoted form of fileName & " | sed 's/.*www\\.\\([A-Za-z0-9]*\\).*\\(\\.png$\\)/\\1\\2/'"
    tell application "System Events" to set aFile's name to newName
end repeat
于 2013-02-07T17:59:00.710 回答