Can files deleted by Idea be recovered?

Answered

I was wondering: what approach does Idea use to delete files? I used the `testdisk` recovery program and I can recover random files, but nothing is shown inside the `src/` folder I accidentally deleted from Idea (a folder containing all my projects in multiple programming languages, with all the repos, everything).

In case it matters, this is how I did it:

- I opened Idea. The files shown on the left side were wrong. Somehow the project root folder, the one shown under `Project Structure > Modules` had changed to `/home/user/src`. It used to be `/home/user/src/OR/openrndr/`.

- To fix it I thought I should remove that folder and add the correct one. So I clicked on the folder `/home/user/src` and tapped the delete key, accepted the confirmation. And that was the end of that folder. Not just removed from Idea, but removed from my drive. The IDE froze and I had to kill it. Then I realized what I had just done.

0
5 comments

Deleting the directory from the project view will delete the actual files on disk.

Removing the content root and adding a new one in the project structure will only change the project configuration and all the files on the disk will remain, see https://www.jetbrains.com/help/idea/configuring-content-roots.html .

You can restore the files using Local History: https://www.jetbrains.com/help/idea/local-history.html .

0

Thanks, I do realize that the actual files were deleted. I wish there was a double confirmation dialog mentioning that there's no going back.

Local History probably works unless you have deleted all your projects, github folders, idea folders etc. There's nothing left to restore I think.

I'm now taking a look into ext4magic. I hope it can rescue something.

0

Thanks to ext4magic I have recovered the files. Folder structure and git history are lost and it was a very tedious process of reviewing thousands of files with no recognizable file names, but better than rewriting everything.

I'll explain what happened step by step in case it can help someone avoid this or if it can bring a more obvious to Idea.

1. The initial issue I had was that somehow that path you see below changed to /home/funpro/src/. That's two folders above the project folder, and it contains hundreds of projects in different programming languages. This unexpected path change happened in two different computers.

2. To solve it in the first computer I did the right thing: click the little x on the right side of the screenshot. That removed the source project from the folder. Then I re-added the correct path which you see below.

3. When fixing the issue in the second computer, instead of clicking the x I clicked the folder name and pressed DELETE and confirmed the dialog by pressing ENTER. In my mind I thought I was taking the same steps as in point 2 even if the confirmation dialog was different. A moment later Idea froze because all project folders were wiped from disk. It would be great if Idea did not allow destroying the loaded project like this.

Unfortunately after a month of down time due to health reasons I forgot my old habits of weekly backup and daily push to git. I did commit changes, but did not send them to the server (I'm on my own in this project).

1

Oh my gosh I just had the exact same issue - I thought delete would remove the folder from view, but it deleted all my files from disk. And after I did right click undo, all files restored have 0 bytes. 

There should be clear warning from the IDE that "delete" will delete actual files. This has caused great inconvenience 

0

Aiconnie93 if you click on a directory in a project view, and choose Delete, there will be a clear warning that the actual files will be deleted:

0

Please sign in to leave a comment.