LittleFS with ESP32

Hello every one !
I am having a strange issue. Hope someone could help.
I have saved one json file with a file name "\data.json" with the code


It works fine. I can retrieve the data too. 

However when I try  it for a second file , it fails  with filename "\newfile.json" 

``` File file = LittleFS.open(filename, "w") ;

What could be the reason for this ?

That would most likely be in the code you forgot to post.

2 Likes

Have you seen this? loads of info on using LittleFS on ESP32

https://randomnerdtutorials.com/?s=littleFS

Thank you, I had read some of them. The original issue has been corrected.

There is one more issue. During uploads , the IDE is supposed to erase all the contents already existing including the files. However the files already saved seems not to have been erased. On autoreset after uploading , the file that was already saved is accessed from setup() (as per code). How come ? It was supposed to be erased ? any idea about this phenomena ?

Any data stored in the LittleFS (Spiffs) will not be deleted untill you clear Every flash contents from it. On upload if you want clear it go to tools->Erase Flash -> All flash contents , before upload it will delete every flash contents then uplod the code

Or you can add code to clear your file data

1 Like

Thank you very much. I can't figure out how I missed it. After reading your msg, I checked the setting and indeed it was in "disabled" mode. I usually put that in "Enabled" mode.

Thanks a lot.