Recover deleted code from Arduino (solved)

I completely deleted my whole sketch in Arduino 1.8.19 using the Delete option, in the drop down menu (top right corner).

I did it thinking it would just clear the IDE window but it actually deleted the whole folder, including the .ino file, without a trace.

After googling around and searching this forum, I still could not find the file on my drive. Temp folders, searching using DOS, etc, nothing.

I installed Recuva (Piriform), searched the partition of my disk where my Arduino projects are stored and I was able to retrieve the file intact, as it had not be written over yet.

Maybe it will be helpful to someone. I hadn't created a zip backup yet, ended up deleting the whole thing without a clear warning from the IDE.

Maybe time to start using source control; eg, Git ...

2 Likes

Sorry this made you jump through hoops, but understand many users want a "delete" button to delete, and not be required to chase two or three "are you sure?" popups around the screen. The first three laws of programming are (not in any particular order): 1. backup, 2. backup, 3. backup. I know it is not hindsight, because everyone who has ever written code has been told this from day 0, and every day thereafter. I am happy you found a solution. Backups NOT Popups.

The Delete option should send the folder to the thrash or recycle bin. Or at least warn that you are about to completely delete the folder from the system. The Arduino ecosystem is so user-friendly yet this function isn't forgiving at all.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.