Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Apps and Programs
Best way to force empty trash?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Dysfunction" data-source="post: 1362503" data-attributes="member: 51052"><p>Keep in mind, this won't delete files that are in use. You can automate that as well, but as with any automation, you need to make sure you're doing what you want. lsof (list open files) can help you show which files are in use. For instance...</p><p></p><p></p><p>[code]</p><p>## find all files in trash that are in use, and the using program ID</p><p>for i in $(lsof |grep ".Trash" |awk '{print $2}')</p><p> do</p><p>## Kill all pid's using files in trash</p><p> kill $i</p><p>## now use Van's command to empty</p><p>sudo rm -rf ~/.Trash/*</p><p>done</p><p>[/code]</p><p></p><p>If you wanted to unconditionally kill the pids, you'd use a -9 switch.</p></blockquote><p></p>
[QUOTE="Dysfunction, post: 1362503, member: 51052"] Keep in mind, this won't delete files that are in use. You can automate that as well, but as with any automation, you need to make sure you're doing what you want. lsof (list open files) can help you show which files are in use. For instance... [code] ## find all files in trash that are in use, and the using program ID for i in $(lsof |grep ".Trash" |awk '{print $2}') do ## Kill all pid's using files in trash kill $i ## now use Van's command to empty sudo rm -rf ~/.Trash/* done [/code] If you wanted to unconditionally kill the pids, you'd use a -9 switch. [/QUOTE]
Verification
Post reply
Forums
Apple Computing Products:
macOS - Apps and Programs
Best way to force empty trash?
Top