Hello,
For some reason, my freshly-formatted 32G SD card seems to contain a lot of files, and I don't understand why. The card was formatted as FAT under MacOS, using a full-erase option that took forever to execute. And on Mac the SD card is empty (as expected). The names are not just random bytes. Could you help me understand where these file names come from? Do I have some virus, or is this smth specific to 32G cards?
I read it using the following sketch, using an Arduino Mega2560 R3:
#include "SD.h"
#include "SPI.h"
File root ;
void setup(){
Serial.begin(9600);
delay(1000);
Serial.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
if(!SD.begin(53)){
Serial.println("Card Mount Failed");
return;
}
root = SD.open("/");
printDirectory(root, 0);
Serial.println();
Serial.println("Done!");
}
void loop(){
}
void printDirectory(File dir, int numTabs) {
while (true) {
File entry = dir.openNextFile();
if (!entry) {
// No more files
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 {
// Files have sizes, directories do not
Serial.print("\t\t");
Serial.println(entry.size(), DEC);
}
}
}
Here is the output I get:
$ arduino-cli monitor -p /dev/cu.usbmodem21101
Connected to /dev/cu.usbmodem21101! Press CTRL-C to exit.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SPOTLI~1/
STORE-V2/
436B6E~1/
PSID.DB 8192
TM~1.LIO 0
LIO~1.CRE 0
TMP.CAB 0
CA~1.CRE 0
TM~1.STA 0
INDEXS~1 28
~~~~~~21.IND 68544
~~2.IND 16
~~~3.IND 8
~~~~4.IND 3277
~~~~~~30.IND 4
~~~~~5.IND 376
~~~~~~36.IND 2056
~~~~~~39.IND 8
~1.SHA 4096
STOR~1.UPD 8
~1.DIR 65536
0DIREC~1.SHA 1088
LIVE~1.IND 4096
LIVE~~2.IND 32768
LIVE~~~3.IND 16384
LIVE~~~4.IND 3277
LIVE~~~5.IND 4096
LIVE~~71.IND 8192
LIVE~~74.IND 4096
LIVE~~77.IND 8192
LIVE~~80.IND 8224
LIVE~~83.IND 1024
LIVE~~87.IND 65536
LIVE~~90.IND 0
LIVE~1.DIR 65536
STORE.DB 36864
STOR~1.DB 36864
DBSTR-~1.HEA 56
DBSTR-~1.DAT 16384
DBSTR-~1.OFF 16384
DBSTR-~1.BUC 16384
DBSTR-~2.HEA 56
DBSTR-~2.DAT 16384
DBSTR-~2.OFF 16384
DBSTR-~2.BUC 16384
DBSTR-~3.HEA 56
DBSTR-~3.DAT 16384
DBSTR-~3.OFF 16384
DBSTR-~3.BUC 16384
DBSTR-~4.HEA 56
DBSTR-~4.DAT 16384
DBSTR-~4.OFF 16384
DBSTR-~4.BUC 16384
DBSTR-~5.HEA 56
DBSTR-~5.DAT 16384
DBSTR-~5.OFF 16384
DBSTR-~5.BUC 16384
REVERS~1 65536
TMPSPO~1.STA 4096
STORE_~1 4
JOURNA~1.COR/
JOURNA~1.LIV/
JOURNA~2.LIV/
JOURNA~3.LIV/
JOURNA~4.LIV/
JOURNA~1.ASS/
JOURNA~2.ASS/
JOURNA~1.HEA/
JOURNA~1.MIG/
JOURNA~2.MIG/
JOURNA~1 0
JOURNA~1.SCA/
SHUTDO~1 4
REVERS~1.SHA 3136
~1.IND 4096
~~~~~234.SHA 2
LIVE~1.SHA 4096
LIVE~~2.SHA 0
LIVE~~~3.SHA 0
LIVE~~~4.SHA 8
LIVE~~~5.SHA 2056
LIVE~255.SHA 65536
LIVE0D~1.SHA 1088
LIVE~262.SHA 1
REVERS~1.UPD 2
TMPSPO~1.LOC 2081
VOLUME~1.PLI 4469
FSEVEN~1/
FSEVEN~1 36
000000~1 48
000000~2 72
Done!