我有一个完整的屏幕截图文件夹,文件名如下:
http_www.mozilla.org.png
http_www.google.com.png
我想在www之前删除每个元素。以及.org或.com
之后的每个元素我应该在mac上的automator中做些什么来实现这样的目标呢?
由于
答案 0 :(得分: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