Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I was copying a file to /usr/local/bin from the commandline on a Snow Leopard Server 10.6 ... anyhow i typed the following ...

sudo cp ./le /usr/local/bin

Ouch ... that missed last forward slash from a bash shell screwed me. It wacked my directory with a copy of the le file renamed as bin. This is a pretty vanilla machine just used a fileshare. Any thoughts on how to recover? Noticed there is no lost+found ... err, at least I didn't see it in root directory.

share|improve this question
    
Actually this should just copy le into /usr/local/bin, not overwrite it. Are you sure that you lost your bin directory that way? –  patrix Sep 5 '13 at 4:08

2 Answers 2

up vote 1 down vote accepted

Unfortunately there is no way to recover from that, aside from restoring from a backup. Command line utilities don't have an undo command (and they don't typically delete to the Trash).

lost+found wouldn't help either, since that is only used when a filesystem recovery utility has found filesystem corruption.

share|improve this answer

What Brian said, you are in no return land. To avoid such problems in the future add this line to your .bashrc:

alias sudo='sudo '

(and restart bash)

this way cp, mv, rm and suchlike will ask you before they overwrite or delete something. That has saved my bacon a few times.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.