安全清倒废纸篓(AppleScript)
on run {input, parameters} set title to "安全清倒废纸篓" set trashIsEmptyMessage to "废纸篓是空的,不需要清空。" set willDeleteMessage to "请选择清空方式?" set secureDeleteAction to "安全清倒废纸篓" set secureDeleteActionTerminal to "安全清倒废纸篓(详细)" set cancelAction to "取消" set okAction to "好" set errorMessage to "发生错误:" set finishMessage to "已经安全清倒废纸篓。" set srmCommand to "sudo srm -rfsz /Volumes/*/.Trashes ~/.Trash" set srmVerboseCommand to "sudo srm -rfvsz /Volumes/*/.Trashes ~/.Trash" tell application "Finder" set trashCount to count of items in the trash if trashCount = 0 then beep activate display dialog trashIsEmptyMessage buttons {okAction} default button okAction with title title return input end if try beep activate set dialog to display dialog willDeleteMessage buttons {secureDeleteActionTerminal, secureDeleteAction, cancelAction} default button cancelAction with title title on error return input end try set interface to button returned of dialog end tell if interface is cancelAction then return input end if if interface is secureDeleteAction then tell application "Finder" try do shell script srmCommand with administrator privileges activate display dialog finishMessage buttons {okAction} with title title on error errmsg beep activate display dialog errorMessage & errmsg buttons {okAction} with title title end try end tell else if interface is secureDeleteActionTerminal then tell application "Terminal" launch delay 0.2 activate do script srmVerboseCommand end tell --else if interface is deleteAction then -- tell application "Finder" -- empty the trash -- end tell end if return input end run
Finder - 服务 - 安全清倒废纸篓
强行删除(AppleScript)
on run {input, parameters} set title to "强行删除" set willDeleteMessage to "此操作将不经过废纸篓*直接删除*选中的文件:" set fileCountUnitMessage to "个" set deleteAction to "删除" set secureDeleteAction to "安全删除" set cancelAction to "取消" set okAction to "好" set finishedMessage to "操作完成" set errorMessage to "删除期间发生了错误:" set fileCountZeroMessage to "未选择任何文件或文件夹。" set deleteCommand to "sudo rm -rf" set secureDeleteCommand to "sudo srm -rfsz" set fileCount to the count of input if fileCount = 0 then beep activate display dialog fileCountZeroMessage buttons {okAction} default button okAction with title title return input end if set theFiles to "" set theFilesMsg to "" repeat with theFile in input set p to quoted form of (POSIX path of theFile) set theFiles to theFiles & " " & p set theFilesMsg to theFilesMsg & " " & p end repeat tell application "Finder" try beep activate set msg to willDeleteMessage & (fileCount as string) & fileCountUnitMessage & theFilesMsg set dialog to display dialog msg buttons {secureDeleteAction, deleteAction, cancelAction} default button cancelAction with title title on error return input end try set interface to button returned of dialog end tell if interface is cancelAction then return input end if if interface is deleteAction then try do shell script deleteCommand & theFiles with administrator privileges activate tell application "Finder" to display dialog finishedMessage buttons {okAction} with title title on error errmsg beep activate tell application "Finder" to display dialog errorMessage & errmsg buttons {okAction} with title title end try else if interface is secureDeleteAction then try do shell script secureDeleteCommand & theFiles with administrator privileges activate tell application "Finder" to display dialog finishedMessage buttons {okAction} with title title on error errmsg beep activate tell application "Finder" to display dialog errorMessage & errmsg buttons {okAction} with title title end try end if return input end run
在Finder中选择要删除的文件,右键 - 服务 - 强行删除
显示隐藏文件(Run Shell Script)
STATUS=`defaults read com.apple.finder AppleShowAllFiles` if [ $STATUS == YES ]; then defaults write com.apple.finder AppleShowAllFiles NO else defaults write com.apple.finder AppleShowAllFiles YES fi killall Finder
Finder - 服务 - 显示隐藏文件
打包下载地址:
http://pan.baidu.com/s/1eQsG2PW
原文:http://www.cnblogs.com/Bob-wei/p/4883962.html