created Nov 2010
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
*/ #include <SPI.h> #include <SD.h>
File myFile;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
// Check to see if the file exists:
if (SD.exists("SPOTLI~1")) {
Serial.println("SPOTLI~1 exists.");
} else {
Serial.println("SPOTLI~1 doesn't exist.");
}
}
void loop() {
// nothing happens after setup finishes.
}
I know little or nothing about the SD library, but it looks like in order to remove the SPOTLI~1 file you would need to be in the SPOTLI~1 directory but then you could not remove the SPOTLI~1 directory whilst still in that directory.
Itis a directory i have run the card info example provided by the SD library examples and here is a fragement of the output:
IF232017/ 2000-01-01 01:00:00
SPOTLI~1/ 2016-06-04 20:15:40
STORE-V2/ 2016-06-04 20:15:40
6878A9~1/ 2016-06-04 20:15:40
PSID.DB 2016-06-12 14:51:30 8192
TM~1.SNO 2016-06-04 20:15:40 0
TM~1.LIO 2016-06-04 20:15:40 0
LIO~1.CRE 2016-06-04 20:15:40 0
TMP.CAB 2016-06-04 20:15:40 0
in the begining i only used rmdir but it didnt delete the directory (which is not empty as shown in the output ) so i added this remove which is a desperate move ..
in the begining i only used rmdir but it didnt delete the directory (which is not empty as shown in the output ) so i added this remove which is a desperate move ..
I suspect that rmdir() doesn't remove the directory BECAUSE it is not empty. Make the directory the current directory, and delete all the files in it, first. Then, make the directory's parent the current directory, and delete the directory.