1.8.9 ate my sketches...

Hi

I just did a .exe install of IDE 1.8.9, which calls for the uninstalation of the previous version. When I did that, I obviously misunderstood the pop-up message - I thought it would just uninstall the core parts and leave everything else intact but, unfortunately it seems to have wiped out six years of sketches, as the sketchbook folder was in the Program_Files_(x86)/arduino/portable/ path...

I'm not very tech savy (obviously) - are these gone for ever or is there some way to get them back?

Just realised that I've also lost the libraries...

OS ?

Most often they are not gone.
Did you have the folder re-direction to a NON DEFAULT location ?
If you did just point it back to that location.

Also do a search for "sketches" to see if it come up with your old directory ?

They're only gone if you saved your sketches inside the folder that Arduino was installed to. Don't do that. Really, you should never be modifying stuff in the folder that Arduino was installed to.

Sketches, libraries, manually installed hardware packages - all of those should go inside your sketchbook folder (defaults to folder named Arduino in your documents folder).

Sadly, the sketches and libraries were in the default directory of the Arduino installation (on the basis that the Arduino guys knew much more than I did).

That means that they're gone forever, right?

I can find an option to change the storage location for future sketches (to documents/arduino/sketchbook) but how do I change where it will store the libraries?

Sorry to be such a numbskull...

For third party libraries they are in the default SKETCHES folder so if you change that location the LIBRARIES will change by themselves too.

duncan_a:
Sadly, the sketches and libraries were in the default directory of the Arduino installation (on the basis that the Arduino guys knew much more than I did).

That is a convenient location when you want the maximum level of portability of the Arduino IDE, where everything it needs is under one folder. Unfortunately it creates the dangerous situation where updating to a new version of the Arduino IDE will permanently delete your sketchbook. When you have your sketchbook set to a subfolder of the Arduino IDE, you need to copy the sketchbook to a safe location before updating the Arduino IDE. Actually, it would be a good idea to do that for the entire portable folder. That way, you don't need to reset your preferences and re-install any boards you previously installed via Boards Manager.

duncan_a:
That means that they're gone forever, right?

I hate to say it, but I think you're right. The exception would be if you had a backup of your sketchbook stored somewhere.

Although the Arduino IDE usually clears the temporary build folder when you exit the program. I have found that I end up with quite a few of these folders left behind over time. The temporary build folder contains a preprocessed version of your sketch at the time of the compilation. Although it has a little bit of code added, it should be fairly easy to recover back to its original state. The temporary build folders will be at C:\Users{your user name}\AppData\Local\Temp. They are named like arduino_build_69865, with the last number being random. The preprocessed sketch file is under the sketch folder, with .cpp appended to the file name. Maybe you can recover some of your sketches from leftover temporary build folders.

duncan_a:
I can find an option to change the storage location for future sketches (to documents/arduino/sketchbook) but how do I change where it will store the libraries?

The Arduino IDE's Library Manager (Sketch > Include Library > Manage Libraries) and Sketch > Include Library > Add .ZIP Library both install libraries to the libraries folder of your sketchbook folder. You can set the location of the sketchbook folder at File > Preferences > Sketchbook location. If you do a manual library installation, you should also make sure to install the library to the libraries subfolder of your sketchbook folder. Some library authors provide instructions that tell to you install libraries to the libraries subfolder of the Arduino IDE installation folder, but that's a bad idea because libraries installed to that location will be lost when you update to a new version of the Arduino IDE.

duncan_a:
Sorry to be such a numbskull...

Don't get down on yourself. It's a very sad situation. I'm sure we've all lost some data at one time or another. I know I have. The best thing you can do is try to make sure this can never happen again by starting to use a high quality backup system to preserve your irreplaceable data.