Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Mac OS X 10.5.8. I was recently uninstalling mysql5 from /opt/local/bin.

I typed:

rm -rf /opt/local/bin mysql*

instead of

rm -rf /opt/local/bin/mysql*

This deleted my entire /opt/local/bin directory which puts me in a bit of a bind.

Is there any way to recover those files? If not, I have a friend that is using a similar set of programs, would it be possible to use the contents of his folder?

If I end up needing to reinstall everything in this folder, what is the best way to go about doing this?

share|improve this question

migrated from Apr 2 '10 at 23:47

This question came from our site for professional and enthusiast programmers.

No backup? No.... /opt/local/bin is usually your macports directory so (unless you compiled stuff into there) a complete macports reinstall (including apps etc...) could do the trick. You'll of course lose everything you've done under macports. BTW: voting to migrate to – ChristopheD Apr 2 '10 at 23:36
Welcome to UNIX. This is a rite of passage that every padawan must endure before being accepted into the brotherhood :-) – paxdiablo Apr 2 '10 at 23:38

There is no 100% fool-proof way to recover the files. In fact, if you've left the machine running after issuing the rm command, the OS might have mistakenly viewed the disk space formerly occupied by /opt/local/bin as free space, and may have written something there. Once that happens, complete recovery becomes pretty iffy.

Although there are data-recovery tools which one might use when such a disaster strikes, fortunately for you you lost programs, not personal data. The easiest, most sure-fire way to restore the directory is to reinstall the programs.

PS. Welcome to the club. It is usually only after such an experience that one becomes enthusiastic about backing up!

share|improve this answer

I reinstalled ports and all apps, etc.

I'm back up and running and getting a good backup strategy in place.

share|improve this answer
I recommend a cheap USB external drive and Time Machine for now – Paul R Apr 3 '10 at 8:00

You must log in to answer this question.