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) data2) 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.

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.

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?

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.

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.

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...

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...

I have the same issue...how do you use the terminal to do this? I'm fairly new to MAC so need some details please. Thanks in advance!!! I have over 357k items to delete and it estimates 4111 hours to do this!

Is there a reason why you save so many files in the Trash? It would be a lot easier both to know what is in Trash and to empty Trash if you did it more regularly. Not to mention the disk capacity becoming available from emptied Trash.

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.

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 usingrmin 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

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 directorypwd # display current working directory

The "pwd" should say something like "/Users/yourusername/.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!

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 willbe 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 filesin 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 isslightly 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 creatingan additional directory level at the destination (discussed in the manual).

More Like This

Retrieving data ...

This site contains user submitted content, comments and opinions and is for informational purposes only.
Apple may provide or recommend responses as a possible solution based on the information provided; every potential issue may involve several factors not detailed in the conversations captured in an electronic forum and Apple can therefore provide no guarantee as to the efficacy of any proposed solutions on the community forums.
Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.