if(!SPIFFS.exists(path1+"edit/Test2.txt")){
// Create a file
File file = SPIFFS.open(path1+"edit/Test2.txt", "w+");
// Check if the file has been created and if it is possible to write information to it
if(!file){
Serial.println("Can't open file for writing");
SPIFFS.end();
return;
}
else {
file.write("Hellow, world\n");
file.close();
}
}
I check for the existence of files like this:
void main_scan(String path){
int v = scan_dir(path);
Serial.print("Total used in Dir \"" +path+ "\" = ");
Serial println(v);
}
unsigned long scan_dir(String path) {
Dir dir1 = SPIFFS.openDir(path);
unsigned long total_size = 0;
while (dir1.next()) {
if (dir1.isFile()){
Serial.print("File:\t");
Serial.print(path + dir1.fileName());
Serial.print("\tSize:\t");
unsigned long f_size = dir1.fileSize();
Serial.println(f_size);
total_size += f_size;
}
if (dir1.isDirectory()) {
unsigned long dsize = scan_dir(path+dir1.fileName()+"/");
Serial.print("Dir:\t");
Serial.print(path+dir1.fileName()+"/");
Serial.print("\tSize:\t");
Serial println(dsize);
total_size += dsize;
}
}
return total_size;
}
Can someone tell me why when using FSBrowser files that are created using commands are not visible? And how to make these files visible?