Arduino SD.rmdir()
Description
The SD.rmdir() function removes a directory from the SD card.
Syntax
SD.rmdir(filename)
Parameters
- filename: the name of the directory to remove, with sub-directories separated by forward-slashes, /
Returns
- true: if the directory is removed successfully.
- false: if the directory is NOT removed successfully.
Example Code
/*
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: https://arduinogetstarted.com/reference/library/arduino-sd.rmdir
*/
#include <SD.h>
#define PIN_SPI_CS 4
File file;
void setup() {
Serial.begin(9600);
if (!SD.begin(PIN_SPI_CS)) {
Serial.println(F("SD CARD FAILED, OR NOT PRESENT!"));
while (1); // don't do anything more:
}
SD.rmdir("arduino/log"); // delete the directory if existed
}
void loop() {
}
Tutorials
See Also
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables .
Additionally, some links direct to products from our own brand, DIYables .