I want to write a function that removes all directories(including subdirectories and files) from my SD card.
And there is a build-in function for this called "rmRfStar()".
But I'm too silly to use it.
Maybe one can help me out....
That is my code so far:
I'm able to find all the directories I want to delete but I'm stuck on how to make my way from "File" type to "SdFile".
All the Arduino examples I found use rmRfStar() directly from the "File" object but Teensy seems to not support that.
Uwe.
And there is a build-in function for this called "rmRfStar()".
But I'm too silly to use it.
Maybe one can help me out....
That is my code so far:
Code:
File root = SD.open("/");
while (true) {
File entry = root.openNextFile();
if (!entry) {
// no more files
break;
}
if (entry.isDirectory()) {
// now delete it
// how to convert "File" into "SdFile"?
SdFile sdf;
uint8_t result = sdf.open(&sdf, entry.name(), O_RDONLY);
Serial.println(result); // => 0
result = sdf.rmRfStar();
Serial.println(result); // => 0
}
.....
I'm able to find all the directories I want to delete but I'm stuck on how to make my way from "File" type to "SdFile".
All the Arduino examples I found use rmRfStar() directly from the "File" object but Teensy seems to not support that.
Uwe.
Last edited: