HELP!!!! Undo deletion in Terminal

Discussion in 'Mac Programming' started by Chef Medeski, Dec 28, 2005.

  1. Chef Medeski macrumors 6502a

    Chef Medeski

    Jun 14, 2005
    New York, NY
    The idiot I am, I decided to practice my Unix commands by cleaning out my iPhoto Library. Well guess what I hit cd .. one too many times and then just deleted the last folder accesses, which means instead of deleting one day folder that was empty. I deleted a whole month of family vacation in JULY!!!! :eek: :eek: :eek: :eek: :eek: :eek: HELP!!! I looked in the Trash Can and nothing. I don't know what to do, why did I have to procrastinate in backing up my harddrive. SOMEONE HELP!!!!
  2. MacAficionado macrumors 6502

    Oct 5, 2002
    An awesome place
    Sorry, no undo in terminal.

    I take it, you don't back up.
  3. Nermal Moderator


    Staff Member

    Dec 7, 2002
    New Zealand
    Step 1: STOP USING THE COMPUTER. Deleted files get overwritten by new data, and as long as you're using the system, new data is getting generated.

    Step 2: Use a file-recovery tool. I think DiskWarrior can do this. It runs from its own CD and therefore doesn't overwrite your deleted files.
  4. Flying Llama macrumors 6502a

    Flying Llama

    Aug 4, 2004
    Los Angeles

    You see, when you delete a file, the computer actually only deletes it from the index. Your files are most probably still there!

    The point? You need to buy Data Rescue II. It costs $99 but I'm sure it's worth your vacation pix. Good luck! :)
  5. Chef Medeski thread starter macrumors 6502a

    Chef Medeski

    Jun 14, 2005
    New York, NY
    You have anything for free. Luckily I opened my iPod and noticed that instead of deleting a whole month it was actually only 20 pictures. I have the compressed versions on my iPod, so they are not totally lost, just compressed. So, if you have anything for free.
  6. tag macrumors 6502a


    Apr 29, 2005
    I know this won't help you right now, but hopefully this will help you from doing this again. In your home directory (cd ~) edit your '.profile' file, or create it if you don't have it and add this line...

    alias rm='rm -i'

    That way, next time you delete something via 'rm' in terminal, you will be prompted asking you if you are sure, that way you can think about it for a second and recheck what you are deleting.

    Or alternately you can do a bit of research and use alias and a logout script to create a trashcan type thing, where when you type 'rm' (via alias) you move the files to a temporary trashcan, say ~/.trash, instead of instantly deleting them, and then the logout script(executed through a .profile trap; a google search will explain how these work) would 'rm ~./trash' then 'mkdir ~/.trash' at logout cleaning out your trashcan when you logout.
  7. greatdevourer macrumors 68000

    Aug 5, 2005
    Or, if you know precisely what the folders/files are called, then you can try rm -w (I think - just check the man for it)

Share This Page