Jump to content

Force Empty Trash


Recommended Posts

/Volumes/*/.Trashes
 

 

 

Probably need sudo privileges to get at all files though.

 

I have an alias:

 

 

 

alias emptytrash='sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl'
 

but that of course prompts me for my password. 

 

Anyone know of a way to get sudo privs in a workflow? NOPASSWD=/bin/rm  and ssh to localhost with authkeys? ... poor security though.

Link to post
  • 2 weeks later...
  • 3 months later...

The script doesn't work because you MUST enter a password to sudo. I've modified Sebbo's commands as you might need the Apple System Logs, and  put it into an NSAppleScript command. So here it is. This script will work on locked and busy files, which is why you'd force empty the trash, right? You've been warned.

 

For any sudo command, you MUST put it into an NS and not a background OSA script because you have to enter your admin password ONCE for every sudo session. That's just how Unix (even in OSX) works. So yes, you will get that auth dialog, you'll key in your admin password (you're on the sudo'ers list, right?), then feel remorse as that file is never coming back.

 

https://dl.dropboxusercontent.com/u/532682/Force%20Empty%20Trash.alfredworkflow

 

The most current version that I'll be tweaking will be at Github:

 

https://github.com/leoofborg/Alfred_Force-Empty-Trash-

 

This was hacked together late last night on a whim with no coffee. Then modified today, still no coffee.

 

Test: Locked file on the desktop, move to trash.

 

Original v2 script: FAIL

      This v2 script: PASS

 

Do as thou wilt.

 

-Leo (don't make me read forums late at night)

Edited by leoofborg
Link to post
  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...