Deleted all my files in my work directory


#1

Hello Everyone,
It would be really helpful if anyone could tell me how to get back all my files which I deleted unknowingly by typing in rm -rf * .c9 in the command line mistaken that I am actually in another directory and now I have lost all my months worth of work. So is there a way to get back all my files, if so please let me know. I have shared my workspace at many places where I claimed of having done these projects.


#2

Yes, there is a way to recover your files, but first, please, please use some form of backups in the future, git and GitHub are extremely easy to set up and can save you the trouble of recovering your files.

In order to recover your files, you’ll have to recreate the files and revert them to a previous version. For instance, say you have an index.js file that you accidentally deleted. Recreate the file, then open it. Right click in the blank file, select “File History”, and move the bar at the top backwards, or click the left arrow button to go to the last changes. Once you’ve found the version you want to revert to, click Revert. Your file will now be returned to its original state.

As far as I’m aware, there’s no way to recover files other than that, but I might be wrong. Also, in the future, it’s recommended that you don’t use the -f (force) flag when removing files, as that could potentially save you deleting all your files.


#3

Thanks alot dannytech. I used the collab.db file to get all the directories and the file names and I used File History on each of these files to get all of them back. Thanks alot once again.