Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Apr 2 '10 at 23:47

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

2  
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 superuser.com. –  ChristopheD Apr 2 '10 at 23:36
3  
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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.