下面的脚本应该删除所有以.aux等结尾的文件。在当前目录中(即查找窗口中显示的目录)脚本似乎在删除.aux文件时暂停。欢迎任何提示。
try
tell application "Finder"
set lieu to target of window 1
set finale to {".aux", ".log", ".bak", ".out", ".synctex.gz"} as list
repeat with x in finale
try
delete (every item of lieu whose name ends with x)
end try
end repeat
end tell
say "Mess cleaned up"
on error
display dialog ("Error. Couldn't Delete the File") buttons {"OK"}
end try
这里是一个使用rm
:的版本
tell application "Finder"
set lieu to target of window 1 as text
set posixPathOfLieu to POSIX path of lieu
set shellScript to "cd" & space & quoted form of posixPathOfLieu & ";rm *.aux *.log *.bak *.out *.synctex.gz"
try
do shell script shellScript
end try
end tell
使用rm
时,请格外小心。错误位置的一个空格字符可以删除所有内容。