I guess you deleted the primary sketch tab? When you do that there's a dialog you must confirm: "Are you sure you want to delete this sketch?" Unfortunately if you don't have a separate backup I don't think there's anything you can do other than starting over since the sketch is not deleted to the recycle bin.

I have some older, older backups from October. I am just really mad at myself. I have never seen an app delete a folder and especially since it all all my archived versions. :frowning:

Actually now that I think of it, there's a possibility you could still have a copy of the sketch code on your computer in the temporary build folder. This is where the Arduino IDE stores the preprocessed sketch before the compilation happens. Where that folder is depends on your operating system. On Windows it's at C:\Users{user name}\Local\Temp\arduino_build_{some random number}\sketch. The file will be named the same as your sketch but with the .cpp extension added. Note that operating systems like to hide that folder location by default. Note that the Arduino IDE will usually delete the temporary build folder when you exit but sometimes something goes wrong and they get left behind.

I agree it's a bit unexpected for the IDE to delete the entire folder, rather than just the .ino file. I think the idea is that to the Arduino IDE that primary .ino file represents the whole sketch. I think it would be reasonable if you wanted to submit an issue report to the tracker requesting this behavior to be changed:

I did a search and didn't find that it had already been requested.

You might take this as an opportunity to review your backup system to see if it can be improved so that you won't be able to lose so much data in the future.

The most awful thing is that a recent backup in zip form CORRUPTED and won't open.

This is so Dumb!

I have many times deleted individual tabs from a project with out issue, this time been working on code for a class for a few hours and after lots of moving things between pages decided to do come tidying up before adding it to Github.

didn't even think as i deleted the tab and IDE closes and its all gone!

IF the IDE is going to delete the entire project that's fine but at least push it to the recycle bin in these cases.

Not that it helps you feel better, but, I just had this happen. I opened a single tab sketch I've been working on. For some unknown reason the sketch now contained two tabs. The second tab was of another sketch I had open earlier. I cut and pasted the content of both tabs to notepad++, just in case. Attempted to delete the second tab. then closed the IDE. Poof! Everything I had, in a folder containing 6 sub-folders, along with links an informational text files, in the root folder, was gone. What the hell!

I am amazed how others have had these type of issues, for a while now, and the responses they get from some of the old guard around here. Pointing there finger an accusing the user. Implying that the user must have done something wrong.


Don't really consider myself "old guard" but from past experience it often is a user end issue.

However that said did, you consider adding actual details of your problem ?



could a 'software recovery' program get something back?

I thought that when something is deleted it's just the file information in the 'table' that goes and the code, etc, is still there until it gets over-written at a later date?



There is a strong chance a data recover program can pull things back.

Some caveats in that it can depend on the computer having had relatively little use since the disaster.

There have been no file clean ups / defrag operations.

It can also be a time consuming operation.



I recall using one on Win95 PCs back when I was doing PC support, ' Gold' (can't remember the name now), and it could search a specific directory to see if anything had been deleted there. It came back with a percentage chance of recovery and usually only took a couple of minutes.

But as you state, it had to be run very soon after the delete or sectors would likely have been over-written,

The best option is to copy everything to another location every few minutes or so to keep an up to date backup...a habit picked up while working on the original array of home computers.


There are some very good open source utils out there. Also the "HIREN" CD/USB bootable has some good things on it and was one of my GOTO as a tech.


Hi Bob,

I had a look at that this evening.

There's so much stuff on that DVD it looks almost too complex to use.

Programs I've never heard of before.

I got out of PC / Server support in '99 when I accidentally drifted into Voice, Data & Security Networks, and I stayed at that for the last 14 years. I retired in 2013.

But it made me think, could someone who understands that stuff put together a basic 'recovery CD / USB' for getting out of the most common Arduino problems that people are reporting here every day?

Maybe to clear out the files and reload a chosen IDE? Take a specified folder or drive and find deleted files, especially sketches, that could be reclaimed.

Beyond my skill level currently.


That DVD is broken down into sections during use and is quite easy to navigate.

I was more referring to your case scenario which is quite a rare one.

As for general clean up I usually supply the attached pdf..




First. Let me say that I built a "trainer" based on an "Intel 8085" back in the early 1980's. First assembled "PC" clone the next year. Just pointing out that I've been around the block once or twice. Have certainly made my share of "operator errors" in that time and, at this stage of my life, have no problem admitting so, if I am aware of doing such. Just saying that I am not a "typical" user, I guess. And. Just trying to give some confidence in what I reported. :slight_smile:

Here is some additional details.

I am currently running Arduino IDE 1.8.9. Three months ago, I performed a complete system refresh of Windows 7 Home Premium. Followed by a fresh install of the IDE version 1.8.9. Just a routine I do from time to time. I have it down to a science.

I am currently developing for ESP8266. Using the ESP8266 ver. 2.5.0 Core.

The situation with the "two tabs" and deleted content happened after I had saved my current sketch (single tabbed) and had shut down for the day. The next time I opened my current sketch, there existed two tabs, consisting of my "current" sketch, and a previous version of the same sketch. The previous sketch had been saved under a different name and in a separate sub-folder (of course). Could I have done something in error to cause this double tab situation? Possible. But not that I am aware of.

Never having this happen before (the mysterious second tab), and my experience with "computing" telling me to cut-n-paste copies (to Notepad++) of both sketches before I do anything else, saved me.

I then "deleted" the second tab. Then closed out the IDE (with only the first tab now being present), and responding to NOT "save" the current sketch. After this, is when I discovered that everything in my (for this project) "root" folder had been deleted. In hindsight. Had I just closed out the IDE, without deleting the extra tab, or affirming "saving" the sketch, I bet I would have been ok.

One possible piece of information is the fact that ALL of these sub-folders, and sketches within, had recently (within the prior couple days) been opened in the IDE at one time or another. The other content I lost was either contained in these sub-folders, or in the root folder.

A small diagram of the folder structure

Root(Main) folder
sub-1 (was deleted by IDE)
sketch + possible other content
sub-2 (was deleted by IDE)
sketch + possible other content
sub-3 (was deleted by IDE)
sketch + possible other content
sub-4 (was deleted by IDE)
sketch + possible other content
sub-5 (was deleted by IDE)
sketch + possible other content
sub-6 (was deleted by IDE)
sketch + possible other content
other content (was deleted by IDE)

For those suggesting a "file recovery".

Being that I did have my current sketch (saved separately), recovering wasn't a big issue. Other sub-folders contained previous versions of the current sketch, in various stages, or tested code chunks. Fortunately. I was at a stage of development where I was just cleaning up "comments" and such in the code. Other content was easily obtainable (links) or easily recreated, or not that important at this stage (information text files).

I did attempt a recovery, just out of curiosity. My development system was tied up a fair share of yesterday, running two different recovery programs, both being run from a USB stick (portable versions) so as not having to do an "install" on my system, to preserve it's integrity. I was able to locate the deleted files. But did not find a version of one which contained the "two tabs" sketch. I had not actually saved a version, as far as I know, of a double tabbed sketch. Assuming that the IDE had somehow combined the two sketches into one after opening the one (current version) sketch. I did find the expected versions of the sketches, which had made up the content of the double tabbed sketch. Each one, individually still opens as they had been previously saved. A single tabbed sketch.

Any other details that others feel is needed, let me know. Thanks to all for their interest in this.

For me the real issue is the lack of highlighting what you are doing.

If you chose to delete a "secondary" tab, the dialog that comes up says "Are you sure you want to delete this tab..... please click OK"

If you chose to delete the "primary" tab, the dialog box looks almost identical at a glance with only a slight change to the wording.

If you are use to creating and deleting tabs you have no reason to read it though each time to see the same thing so you get in the habit of just clicking "yes" knowing what the expected behaviour is.

IT would be nice of the IDE just added an conformation step or like in other application ask you to confirm the name of the sketch you wish to delete.

However failing this I now use GitHub so I always have a backup. its so easy to set up and wont help recover whats i lost but will insure it does not happen again.