我正在尝试使用一行Applescript删除已知目录中的文件 - 但我无法识别该目录: osascript -e'告诉应用程序“Finder”删除(名称为“MyFile.txt”的文件夹“/ Folder1 / folder2”的全部内容的文件)'
但是我收到以下错误:
29:183: execution error: Finder got an error: Can’t get folder "/Folder1/folder2". (-1728)
我也尝试过:
osascript -e 'tell application "Finder" to delete (files of entire contents of folder "folder2" of folder "Folder1" whose name is "MyFile.txt")'
但是有类似的结果 - 它找不到Folder1
我希望脚本可以跨计算机工作,所以我不知道磁盘名称是什么。
有人有任何建议吗?
提前致谢!
答案 0 :(得分:0)
尝试:
tell application "Finder" to delete (files of entire contents of folder (POSIX file "/Folder1/folder2") whose name is "MyFile.txt")