【问题标题】:Terminal: How to permanently remove a file off hard drive终端:如何从硬盘驱动器上永久删除文件
【发布时间】:2019-05-05 01:59:42
【问题描述】:

所以我一直在创建一个本质上类似于 HelperBot 的程序,我想添加一个功能,它可以从硬盘驱动器中完全删除文件,而不是将它们移动到垃圾箱并清空垃圾箱。我正在使用 AppleScript 进行编码,这是我的代码: “做shell脚本“rm /user/Downloads/file.app/*”” 这是错误的还是有其他方法可以做到这一点?

【问题讨论】:

标签: terminal applescript


【解决方案1】:

系统事件将永久删除文件而无需通过回收站:

tell application "System Events" to delete the file "/path/to/file.ext"

或者,删除文件夹:

tell application "System Events" to delete the folder "/path/to/folder"

【讨论】:

    猜你喜欢
    • 2011-08-17
    • 2014-11-03
    • 2016-10-31
    • 2013-06-29
    • 1970-01-01
    • 1970-01-01
    • 2012-11-03
    • 2013-09-10
    • 1970-01-01
    相关资源
    最近更新 更多