Recovering files deleted via sudo

sudotrash

I deleted some files via sudo rm -rf ~/.Trash/* – unfortunately I accidentally moved a folder from the Desktop into there and can't seem to recover it.

I only use this command now and then, when I need to; but how can I recover these files? I know it's a powerful command, but I cocked up this one, but at least I didn't delete system files… only a few personal JPG and PDF files.

I tried two data recovery utilities but it didn't seem to find the folder or its contents… why?

I have one backup of the folder with some of the contents on stored on an external HD, but that's not as up-to-date; the file was deleted 11 Apr 2014 – that's today.

How can I fix this?

Best Answer

Please stop writing to your hard drive this instant. That means turning it off if your system is running from said hard drive. The more you write on the HD, the more likely you are to write over the data you want to recover. And a running OS is writing on the HD.

Once you’ve done that, I can’t think of any reason why there would be any difference between files you’ve erased by emptying the Trash and files you’ve rmed1.

So the best solution you have is:

  1. Boot from another disk.
  2. Run a recovery utility such as Data Rescue.

1. By the way, why rm the Trash?