0

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.

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

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .