then the directory listing now returns nothing at all. The SD.open() still succeeds, but the call to dir.openNextFile() inside printDirectory() always fails.
It doesn't matter if the file I'm testing for actually exists on the SD card or not - SD.exists() returns the right result, but in either case dir.openNextFile() will fail.
This looks like I bug, unless I'm misusing it in some way...
had a quick look at the SD lib (in your arduino path) and the exists function calls the walkpath(...) function to walk the tree to see if it exists. What I saw it traverses the whole directory so some pointers might be at the end.
@fat16lib Thank you for noting to call rewindDirectory (I was having many issues with this) before using printDirectory.
I was trying to pass-through a modified library function that passes back file creation time, so I could convert it to a unix-time with timezone offset for comparing values. So I would call printDirectory to get a list of fileNames, then check creation date time. When I tried:
** if (!entryFile.dirEntry(&d)) {**
** Serial.println("Error Date");**
** }**
it would shift the position printDirectory started at and causes the first one to fail. Using the rewindDirectory before printDirectory fixed it though.