Recover FIles/Folder from sudo rm -rf Terminal Command

findersymlinkterminal

Short Story:
I was attempting to create a symlinked folder from my external to my desktop, and the folder I wanted (ALL of my working folders and files) are gone.

Long Story:
My job wanted me to use Box Sync for my files. I installed Box Sync, and told it to use my work external HDD as the sync. It created a folder on there called "Box Sync".

On that same HDD, I had a folder on there called "Work Files". I opened up Work Files in another window, and dragged and dropped everything from there into the new Box Sync folder.

Box Sync started scanning so it could sync. There were a LOT of files and folders in there, so it didn't start syncing right away. While it was scanning, I decided to create a SymLink of the folder onto my desktop. I can never remember the terminal code, so I used the instructions in THIS ARTICLE.

In the article, they say to do:

sudo rm -rf /PATH/TO/COPY

and then

ln -s /PATH/TO/PASTE/

Howerver, directly after using the first line, my "Box Sync" folder was deleted off of my external.

How on earth can I undo this damage?

Best Answer

The command you ran first deletes all files and folders in /PATH/TO/COPY; note the warning above the command in the article you linked to: "Next, remove the existing Downloads folder (make sure it is empty first)."

Though the data is probably still present on the drive, the operating system now has no idea where it is.

Assuming that you don't have backups available, your only option at this point is probably to use some kind of file recovery software. This answer at Superuser has some links to potential options. PhotoRec is a free, open-source solution that might work.

Best of luck, and be sure to back up your data (ideally to multiple places) in the future.