Delete Problem Files With Terminal 5


Delete Problem Files With Terminal


Every so often you will come across a file or folder that will just not delete when you try. This quick trick tonight will explain how to delete this problem file using both Terminal and a minimal amount of writing. It will get rid of any file you want. Perfect.

First, open up Terminal and type the following:

sudo rm -R

Note there should be a space at the very end of the command line.

Then drag and drop your files from Finder onto the Terminal window. You can drag as many as you want. When you are finished simply hit return and type your password. You file will promptly be deleted. This will work for any file or folder.

This is a lot quicker than changing all of the settings in the Get Info pane or writing the command by hand. Be careful mind. Any files you do delete you can’t get back unless you have a Time Machine backup of them.

If you want to take your skills with Terminal a bit further I recommend you check out the Terminal Category on this site. If you fancy reading a book there is a couple on Amazon that I regularly see mentioned and recommend, O’reilly Unix Geeks and Unix Under the Hood both are designed for Mac OS X and take Terminal further.

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

5 Responses to “Delete Problem Files With Terminal”

  1. 1

    HEY….THis IS My Tipp…i Demand You To Give Me Credit…u have To Remember……It Was ME who sent u this command line…..

    Comment By Bhavya Chugh on September 3rd, at 9:50 pm

  2. 2

    Oh yeah, I forgot you sent me this tip. It was slightly different to the tip you sent. Anyway, thanks for the idea. BTW, the command line was already there you just found how to use it.

    Comment By admin on September 3rd, at 9:52 pm

  3. 3

    oh my god.. i did the stupidest thing.. i thought your first command was for starting up before deleting.. and end up deleting the whole thing.. is there anyway to recover them?

    Comment By jk on January 31st, at 1:57 pm

  4. 4

    Nice, thanks a lot

    Comment By Ian on June 5th, at 11:17 am

  5. 5

    For some reason this isn’t working for me. I have a problem with two files – one of them thinks it has a size of 576 PB while the other thinks it has a size of 4 PB. Due to this, my Macbook won’t start, but I have, via my external hard disk, gained access to my Macbook.

    Now i’ve tried your way, and my “code” ended up saying: “rm: /Volumes/Mac HD/Library/Application Support/iPhoto/Themes/Assets/SnowflakeSnapshots/Icons/snoaflaၱe-h-cover1-def.tiff”
    This should be perfectly correct, but for some reason the terminal just ends up saying : “No such file or directory”

    What can I do?? :(

    Comment By Daniel on July 19th, at 12:20 pm