where have my sketches gone??

OK...
I am beyond the point of calling myself sloppy.
Several times now, I have saved my code, flashed it into my Arduino which I tested and played around with.
And after some day's I'm intending to pick the project back up again and it is gone!
At first, I thought I did not save the program, so I blamed myself.
But It seems I'm doing something wrong in saving (again, to blame myself).

When I save the sketch using a new name, I suppose the older sketch keeps on existing, right?
Where does the old sketch get stored then? And where is the newly "re"named sketch gone?

I've looked in my laptop and searched for *.ino files, filtered by data. But my old sketch is gone.
I think "saving as" does not save in the Arduino folder, but I should have found that sketch when searching the whole HD, right?

Any advice? Auto stored backups?
Does Arduino automatically save (or asks to save) when the PC is turned off?
And does Arduino automatically saves the sketch when compiling and uploading it to the target?
I might have gone wrong there, Maybe... :roll_eyes:

Look in your documents directory.

Check the IDE preferences.

If you use Save As to give a sketch a new name, which is common when saving a new version, then the old version is left intact where it always was, but the IDE will remember the location and use it for subsequent Save As operations. Normal Saves will still go to your sketchbook folder

Is there a chance that you did a Save As to somewhere other than your main disk ?

What is the full path to your sketchbook folder ?

FTMZ:
When I save the sketch using a new name, I suppose the older sketch keeps on existing, right?

Correct.

FTMZ:
Where does the old sketch get stored then?

Wherever you saved it to. When you save the sketch for the first time, or do a File > Save As.. to rename, you get a dialog where you select the location and filename to save to. That's where it is.

FTMZ:
And where is the newly "re"named sketch gone?

Same answer. It's in the place you saved it to. If you don't remember, you can open the sketch in the Arduino IDE and then select Sketch > Show Sketch Folder. You can do the same to find the original sketch. It should be accessible via File > Open Recent.

FTMZ:
Any advice? Auto stored backups?

Having a backup system is always a good idea.

FTMZ:
Does Arduino automatically save (or asks to save) when the PC is turned off?

When you exit the Arduino IDE, if the sketch has been changed since the last save, the IDE will show a dialog asking if you want to save. If you shut off your computer using the operating system, it should prompt you about this. But if you just cut the power on the computer then of course it doesn't have that opportunity.

FTMZ:
And does Arduino automatically saves the sketch when compiling and uploading it to the target?

By default, yes. You can configure that behavior via the File > Preferences > Save when verifying or uploading option.

You can configure that behavior via the File > Preferences > Save when verifying or uploading option.

That option is turned on by default which has always seemed dangerous to me as it can have the effect of overwriting a working sketch with one that you have changed in a way that does not work as it prevents going back to the working version

It certainly caught me by surprise the first time I used the Arduino IDE. I tend to make changes to sketches for the sake of experimentation or troubleshooting that were never intended to be preserved so I always turn that setting off immediately when I set up a fresh install of the IDE.

I have noticed similar behavior in some other popular software so I think it's maybe not so unusual.

OK, Thanks for all the replies, guys... :confused:
I have searched for ".INO" files. Is there an other type of extention to use when looking for old sketches?
Even after reading all the replies, I still see no likely cause of deleting or overwriting my files.

I searched for .ino files in the "entire computer". Is that realy the entire computer, or does it miss certain folders?

It is a laptop btw, which will sometimes go in standby modus. But I never actually shut it down intirely.

1: Did you check the Recycle Bin?
2: Are you logged in to Windows using another account than a week ago? Try logging in as Administrator, and look if there are other user folders under C:\Users\ , that you may not have access to now.

PS.: My sketches are in C:\Users\Erik\Documents\Arduino

FTMZ:
Is there an other type of extention to use when looking for old sketches?

The Arduino IDE also supports sketches with the .pde file extension.

FTMZ:
Is that realy the entire computer, or does it miss certain folders?

It depends on how you have it configured. It's likely that the default is to not search hidden files and system directories

1 Like

Well... I have to accept that it's gone.
I do not know where things went wrong. But I'll have to keep alert in the future in saving some more, and creating extra backups.
Fortunately, it was not a big, complex sketch.

[UPDATE]
I might have a clue where things have might have gone wrong!
Sometimes I open an existing sketch to monitor things or to copy certain pieces of code.
If in that matter, there are two of the same sketches open, I might adust one of them, but when shutting down other windows, I likely admit in saving that particular sketch, which is an older version, missing all the corrections I've been making, therefor overwriting, or actually undoing all the changes...

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