Cannot Empty The Trash In Mountain Lion – File In Use 1

Tip

Share
Cannot Empty The Trash In Mountain Lion – File In Use

Hey,

Finder and its Trash are normally pretty reliable. If you press the empty Trash button in Finder, the contents will be deleted. Every so often there is this one file that is stubborn and won’t want to be deleted and needs a bit of a poke in the right direction. Most of the time you will get an error message “File In Use” and it cannot be deleted. The first step in trying to get rid of it, is to ensure that you have closed the app you think has it open. The second is usually a restart as this clears the memory and unlocks the file. If it still won’t be deleted you can try the tip below.

Emptying The Trash When A File Is In Use

[Note there was supposed to be an image here illustrating "File In Use", but I deleted it testing this tip]

To delete a file is in use we need to use Terminal. Open it from the Applications > Utilities folder.

Within the command prompt type the following:

cd ~/.Trash && rm -rf *

This will change the directory to the Trash folder and then delete the contents. Ensure you have spelt the folder correctly as the rm command is unforgiving if you get it wrong. The double ampersand, &&, between the commands ensures the first command is completed correctly so you don’t go inadvertently deleting the wrong things.

When the command completes you will notice the Trash folder is empty. The star will delete everything within the folder.

Deleting Files From Secondary Hard Drives

If you have more than one hard drive connected to your Mac, there will be a Trash folder on each drive. This means the file in use can be on a secondary drive. The above command will not work. However we can modify it using the following command:

cd /Volumes/[Hard Drive Name]/.Trashes/501 && rm -rf *

This will go to the trash folder on that drive and delete the contents. You need to enter the volume name within the command. Note that if you have a space in the name of your hard drive you can add a backslash, \ , and then a space.

Conclusion

Your files will then be gone. It is a simply command, but one that you need to know to work. Care must be taken with the rm command as it will delete anything without warning.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips