Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is there a way to QUICKLY empty the trash?

When throwing out, say 250000 items, it can take a LONG time. First you wait for the "Preparing to empty the Trash..." and then you suffer through "Emptying the Trash..." My question is, "Is there a quick way to do this?", and if not "Why not?"

Years ago there was the ability to hold down something like the option & command keys while emptying the trash, and it emptied very quickly, but either I've forgotten the key combination, or it's just not allowed anymore.

Having a quick way to empty trash would be very helpful when performing operations such as,
1) clearing an external drive of most (but not all) data
2) removing a very large iPhoto library (or libraries)
etc...

Although I've searched dilegently for an answer to this, all I've found are suggestions to us the "erase" command in Disk Utility or the rm command in terminal. The erase command is useless if you want to keep files on the disk, and the rm command doesn't seem to provide a speed improvement, at least in my hands.

Thanks

17" MacBook Pro 2.4GHz, 4GB, 160GB, Mac OS X (10.5.6), Time Machine

Posted on Apr 13, 2009 9:37 PM

Reply
34 replies

Apr 13, 2009 11:12 PM in response to planb77

I have tried that, and it does not seem to help since the "Emptying the Trash..." step still persists, counting down the items. However, I must admit that I have not done real testing of one method verses another since I usually just wait it out with the slow methods I know, and of course, once something is trashed, why would I trash the identical thing?

But I did just try your method with a fairly large amount, and as I said, the "Emptying the Trash..." step was definitely significant.

I would think that a method that truly works will be real obvious: issue command, bam, it's done, but perhaps that assumption is wrong.

Apr 13, 2009 11:44 PM in response to TMega

TMega,

What you want is really not possible. Removing so many files at once is a terribly complex operation, complicated by the need for journaling and updating of the FS_Events Database. Each modern/advanced feature of the HFS+ file system adds its own little bit of overhead to the process.

You wouldn't want it any other way, in truth.

All this said, there's no reason why you have to wait for these operations to complete before moving on to something else. This is one of the major reasons why the Finder is now multi-threaded; so that you can issue the commend to move files or empty the trash, and carry on immediately to other things, even within the Finder. Can you not do this?

Scott

Apr 14, 2009 7:46 AM in response to Scott Radloff

Scott,

Performing other tasks can be quite slow, even though I have a Core Duo 2.4GHz with 4GB ram, during a major delete.

I don't see why there cannot be a quick way to do a major delete operation since, after all, this in effect happens when you use the "erase" operation of the Disk Utility, which happens almost instantly.

For example, the "quick delete" option that I am suggesting could be a routine which checks the locations of the files which are NOT to be deleted, preserve that portion of the disk, and then perform the "erase" command mentioned above, for the rest of the disk.

Clever software folks like those at Apple certainly could solve this problem if someone like me can. The problem I think, is that there have not been enough complaining about this issue. If it were solved, maintaining hard drives which contain large numbers of files (such as backups, iPhoto libraries, web sites, etc...) would become quick and easy rather than so darn slow that you have to come back hours later and remember what you were doing.

Apr 14, 2009 8:19 AM in response to TMega

I don't see why there cannot be a quick way to do a major delete operation since, after all, this in effect happens when you use the "erase" operation of the Disk Utility, which happens almost instantly.

No, not really. An Erase just in essence deletes all the entries in the disk catalog, something that can be done quite quickly. Deleting specific files from a drive requires much more activity in the OS to properly update all the records, so it takes longer. Creating a "hybrid" sort of deletion might be possible - I'm no file system engineer to know for sure - but would almost certainly require a major re-engineering of the Mac file system (HFS+). But reliability is essential, so any sort of function to erase a file that might pose a risk to the integrity of the remaining data must be avoided; I'll trade off a bit of performance in favor of protecting my data any day of the week.

Apple appears to be moving toward ZFS as a supported file system for large volumes on Macs (eventually it may replace HFS+ as the primary file system for Mac OS X, though that's not certain at this point) which may improve matters, but any file system with high reliability is going to go through a number of steps to delete a file, so deletion of large numbers of files is never going to be a speedy process.

Regards.

Apr 14, 2009 6:21 PM in response to Scott Radloff

Nope, secure empty is not checked in Finder preferences.

Thank you for your explanation. I guess I'll just have to keep waiting hours for the trash to empty when doing major deletes.

Sigh.

I suppose a work around could be to copy OTHER items to another temp location and then use the "erase" feature. In my opinion, using work arounds usually means software hasn't been developed quite as nicely as it could be...

Apr 14, 2009 7:10 PM in response to TMega

TMega wrote:
Nope, secure empty is not checked in Finder preferences.

Thank you for your explanation. I guess I'll just have to keep waiting hours for the trash to empty when doing major deletes.

Sigh.

I suppose a work around could be to copy OTHER items to another temp location and then use the "erase" feature. In my opinion, using work arounds usually means software hasn't been developed quite as nicely as it could be...


You can use the terminal and zap them instantly.

Jun 5, 2009 6:42 PM in response to TMega

With a journaled file system, spotlight considerations, and the safety of a Time Machine backup, keeping hundreds of thousands of files in the trash is very rare. I wouldn't think that Apple would waste the time to engineer a specific feature in the OS for something that shouldn't happen in the first place.

They did engineer an excellent way to recover files that have been deleted.

Jun 5, 2009 7:38 PM in response to dechamp

dechamp wrote:
With a journaled file system, spotlight considerations, and the safety of a Time Machine backup, keeping hundreds of thousands of files in the trash is very rare. I wouldn't think that Apple would waste the time to engineer a specific feature in the OS for something that shouldn't happen in the first place.

They did engineer an excellent way to recover files that have been deleted.

I agree. My trash is essentially always empty. It's not a special storage place, it's the trash bin.
And I don't understand why using
rm
in a terminal is slow, as the OP said.
It's practically instantaneous.
In fact, one could keep a FakeTrash directory on the desktop for the files that are to be stored as "trash" for whatever reason, and then zap that directory in one fell swoop anytime one wished.
Keeping files in the trash for more than one session is never a good idea, IMO. Besides after a while the trash starts to smell 🙂

Jun 5, 2009 8:16 PM in response to KLQ727

I have over 357k items to delete and it estimates 4111 hours to do this!

Do you have Secure Erase enabled? Otherwise it should NOT take 171 days to delete your trash.

If you really want to use the Terminal, then since you are both new the Mac and most likely new to Unix, I hope you have a backup, because what I'm about to tell you is walking a tightrope without a safety net with one eye closed.

Applications -> Utilities -> Terminal

cd .Trash # change current working directory
pwd # display current working directory

The "pwd" should say something like "/Users/your username/.Trash". If it DOES NOT, then STOP!

If the "pwd" command is correct, then you can try to delete the items in the trash:

rm -rf * # this is the dangerous command!

The "rm -rf *" will delete everything in the current working directory and ALL subdirectories below. If you execute this command from the wrong location you will destroy valuable files, so make sure you are positive you are where you are suppose to be when you issue the "rm" command, because there is NO RECOVERY FROM THIS COMMAND!

Jun 5, 2009 10:45 PM in response to TMega

open terminal.app
at the prompt type in the following command:
sudo mv ~/.Trash ~/Desktop/Trash
(press return, enter admin password, press return again.)

Logout, then log back in (a new ~/.Trash file will be created).
Your trash can will now be empty and all your old trash files will
be on your desktop in the new "Trash" folder.

Make another folder on your desktop, call it "rsync".
drag and drop a small file in the rsync folder (any file will do).

Open terminal, at the prompt:
sudo rsync -av --delete ~/Desktop/rsync/ ~/Desktop/Trash

rsync is one of the few terminal commands that has been optimized for speed.
It's like cp and/or rm on steroids.
It can copy and delete files faster than any other terminal command.
In the above example I "tricked" rsync into synchronizing the contents of the
"Trash" folder with the contents of the "rsync" folder (which held only a single file).
rsync deleted all files in the "Trash" folder and added the one file from the "rsync" folder.

I added about 7GB to my Trash folder before running rsync. It deleted those 7GB of files
in a little more than 1 minute. They were all small files copied from my system directories.
Your mileage may vary, I am running a Mac Pro with a WD VelociRaptor boot drive.
I was also running rsync in verbose mode which will actually slow it down a bit
(but it is fun watching the filenames fly across the screen). 😉

be sure to familiarize yourself with rsync's syntax before using it. It is not difficult, but it is
slightly different than rm, cp, etc. The manual explains it pretty well. The syntax in
the command I posted is correct for the example I discussed.
In particular pay attention to the "trailing slash" on the source to avoid creating
an additional directory level at the destination (discussed in the manual).

Be aware of course that rsync does NOT secure delete files.

Kj

Jun 5, 2009 11:22 PM in response to TMega

Note:
Also unlike rm and cp, rsync can be run in "dry run" (-n) mode first. This tells rsync to not do any
file transfers, instead it will just report the actions it would have taken. Combined with the verbose (-v)
mode a listing of files is displayed.
It is a very good idea to run first using the --dry-run option (-n) to see
what files would be deleted to make sure important files aren't listed.

Kj

Is there a way to QUICKLY empty the trash?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.