Hello guys, having a problem with listing the directories on my SD card.
While executing the code in Arduino IDE lists me directories in the form of /year/month/day.TXT PlatformIO only lists me the the day.TXT
Any way to get the full path listed in PlatformIO?
#include <Arduino.h>
#include <SD.h>
void printDirectory(File dir, int numTabs);
const int chipSelect = 10;
File root;
void setup() {
Serial.begin(115200);
while (!Serial);
root = SD.open("/");
printDirectory(root, 0);
}
void loop() {}
void printDirectory(File dir, int numTabs) {
while (true) {
File entry = dir.openNextFile();
if (! entry) {
break;
}
for (uint8_t i = 0; i < numTabs; i++) {
Serial.print('\t');
}
Serial.print(entry.name());
if (entry.isDirectory()) {
Serial.println("/");
printDirectory(entry, numTabs + 1);
} else {
Serial.print("\t\t");
Serial.println(entry.size(), DEC);
}
entry.close();
}
}
PlatformIO gives:
2021/
11/
._04.TXT 4096
._05.TXT 4096
._06.TXT 4096
._07.TXT 4096
._11.TXT 4096
04.TXT 5126
05.TXT 897
While Arduino gives:
/2021/
/2021/11/
/2021/11/._04.TXT 4096
/2021/11/._05.TXT 4096
/2021/11/._06.TXT 4096
/2021/11/._07.TXT 4096
/2021/11/._11.TXT 4096
/2021/11/04.TXT 5126
/2021/11/05.TXT 897
[env:lolin_d32_pro]
platform = espressif32
board = lolin_d32_pro
framework = arduino
monitor_speed = 115200
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1
board_build.f_flash = 80000000L