acidportal

- 😈 Worlds smallest Evil Portal on a LilyGo T-QT
git clone git://git.acid.vegas/acidportal.git
Log | Files | Refs | Archive | README | LICENSE

LittleFS_functions.ino (1305B)

      1 /*====================================================================================
      2   This sketch supports the ESP6266 with LittleFS Flash filing system
      3 
      4   Created by Bodmer 15th Jan 2017
      5   ==================================================================================*/
      6 
      7 //====================================================================================
      8 //                 Print a Flash FS directory list (root directory)
      9 //====================================================================================
     10 
     11 void listFiles(void) {
     12   Serial.println();
     13   Serial.println("Flash FS files found:");
     14 
     15   fs::Dir dir = LittleFS.openDir("/"); // Root directory
     16   String  line = "=====================================";
     17 
     18   Serial.println(line);
     19   Serial.println("  File name               Size");
     20   Serial.println(line);
     21 
     22   while (dir.next()) {
     23     String fileName = dir.fileName();
     24     Serial.print(fileName);
     25     int spaces = 25 - fileName.length(); // Tabulate nicely
     26     if (spaces < 0) spaces = 1;
     27     while (spaces--) Serial.print(" ");
     28     fs::File f = dir.openFile("r");
     29     Serial.print(f.size()); Serial.println(" bytes");
     30     yield();
     31   }
     32 
     33   Serial.println(line);
     34 
     35   Serial.println();
     36   delay(1000);
     37 }
     38 //====================================================================================
     39