arduino-libraries / SD

SD Library for Arduino
http://arduino.cc/
GNU General Public License v3.0
179 stars 155 forks source link

Deleting files in subfolders #130

Closed danielkucera closed 1 year ago

danielkucera commented 1 year ago

Hi, I was struggling with deleting files in subfolders (a/b.txt). At the end I was able to make it work like this:

  root.openRoot(volume);

  while (root.readDir(&p) > 0) {
    Serial.printf("%s\n", p.name);

    if(!memcmp("a", p.name, 1)){
      Serial.printf("%s found\n", p.name);

      uint16_t index = root.curPosition() / 32 - 1;
      SdFile s;

      if (s.open(root, index, O_READ)) {
        Serial.printf("b.txt remove ret: %d\n", s.remove(&s, "b.txt"));
      }
    }
  }

Is there some better way?

per1234 commented 1 year ago

Hi @danielkucera. Thanks for your interest in this open source project. This issue tracker is only to be used to report bugs or feature requests specific to the project. This topic is more appropriate for the Arduino Forum. I'm sure we will be able to help you out over there:

https://forum.arduino.cc/