Delete large amount of OS X files quickly
Ivan | Sun, 2009-06-28 21:41
Let's say you want to delete a backup from an external drive you don't need anymore. This backup will be millions of files if it includes all the system files. If you want to delete such large amount of files using the Finder's Empty Trash command it may take you hours.
A simple trick in Terminal will reduce the time by 40% to empty your trash significantly. Carefully enter this command:
sudo rm -r
Now click and drag the folder you want to delete to the end of the line. This operation will insert the correct path. It will look something like this:
sudo rm -r /Volumes/Backup_Disk/Backups
Press enter and you will be asked for your admin password. Now just wait for the command to complete.
This method is not just faster, but it also runs in the background so you can use Finder normally.
- Ivan's blog
- Login or register to post comments
Instead of 1 hour it will take 40 minutes? Still too long. How come it can't be done instantly?
I think you can't do it instantly. Unless you want to erase the whole disk. In that case you can use disk utility.
See my technique below.
you can try to do it instantly in Terminal. but as it is mentioned, carefully :)
# sudo rm -fr /path/to/the/directory
password:
--

programmer's editor
Greeting,
Thanks for the creativebits.org forum. There seems to be a never ending supply of great information on the net. I love learning new stuff, and will be back to read forum posts regularly! Thanks again.
This is my wet dream!
http://fakesteveballmer.blogspot.com
I am not Steve Ballmer pretending not to be me!
1. Open the Terminal application.
2. Type: sudo rm -rf
Important: Type a space after "-rf". The command doesn't work without the space. DO NOT press Return yet.
3. Open your Trash.
4. Go to Finder's menu bar; choose EDIT, then SELECT ALL.
5. Drag all of your Trash into the Terminal window. This causes the Terminal window to automatically fill in the name and location of each item in your Trash.
6. Press Return.
This method comes in handy if you've already placed the large files in your Trash, as I often do when cleaning up/deleting old Time Machine data.
Still this will take a long time to run, right? Or is this instant?