터미널에서 휴지통을 비우려면 어떻게해야합니까? 비우려면 어떻게해야합니까?

터미널에서 휴지통을 비우려면 어떻게해야합니까?



답변

다른 해결책은 다음 코드를 포함하는 AppleScript를 생성하는 것입니다

tell application "Finder"
    empty the trash
end tell

emptytrash예를 들어 저장하고 다음을 통해 실행하십시오.open emptytrash.app

또는 더 나은 (Chris가 제안한대로)-다음을 실행하십시오.

osascript -e 'tell app "Finder" to empty'

휴지통은 Finder이므로 장기적으로 더 호환됩니다.


답변

휴지통은 실제로 사용자 폴더에 숨겨진 폴더입니다. .Trash

내용을 삭제하면 휴지통을 비 웁니다. 당신이 사용할 수있는

rm -rf ~/.Trash/*

다른 것을 삭제하지 않도록 조심하십시오.)


답변

명령 행에서 휴지통을 관리하기위한 다양한 명령 행 도구에 대한 검토 :

http://hasseg.org/blog/post/406/trash-files-from-the-os-x-command-line/


답변

Homebrew를 설치 한 경우 다음 을 입력하여 휴지통 을 쉽게 설치할 수 있습니다 .

brew install trash

그런 다음 휴지통을 비우려면 명령 줄에서 다음을 입력하기 만하면됩니다.

trash -e

꽤 작은 소프트웨어입니다.

$ trash
usage: trash [-ulesv] <file> [<file> ...]

  Move files/folders to the trash.

  Options to use with <file>:

  -a  Use system API for trashing files instead of asking
      Finder to do it. (Faster, but the 'put back' feature
      in the Finder trash will not work if files are trashed
      using this method.) Finder is still used for trashing
      files you have no access rights for.
  -v  Be verbose (show files as they are trashed, or if
      used with the -l option, show additional information
      about the trash contents)

  Stand-alone options (to use without <file>):

  -u  Check for updates (and optionally auto-update self)
  -l  List items currently in the trash (add the -v option
      to see additional information)
  -e  Empty the trash (asks for confirmation)
  -s  Securely empty the trash (asks for confirmation)

  Options supported by `rm` are silently accepted.

Version 0.8.5
Copyright (c) 2010 Ali Rantakari, http://hasseg.org/trash


답변