Plan to use in a function to be called when index number reaches eight, to remove files.
#include "SPIFFS.h"
char* filelist[12][8];
char i;
char j;
void setup() {
Serial.begin(115200);
if (!SPIFFS.begin(true)) { //Dev board is a ESP32
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
File root = SPIFFS.open("/");
File file = root.openNextFile();
while(file)
{
if(strncmp(file.name(), "/LOG", 4) == 0)
{
j++;
strcpy(filelist[i][j], file.name());
Serial.print(filelist[i][j]);
Serial.print(" " + j);
}
file = root.openNextFile();
}
for(j = 0;j < 4; j++) //Delete only first four files; keep from getting too many log files.
{
SPIFFS.remove(filelist[i][j]);
Serial.print("Removed: ");
Serial.println(filelist[i][j]);
}
}
void loop() {}
First time working with arrays. Having problem getting filename into array and adding index number.
Code compiles. Requesting help solving core panic.
William
Four files hold about one month of data; plan to retain a month of data always on web server.
William