• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

SPIFFS – how to delete a specific file

Q&A Forum › Category: ESP32 › SPIFFS – how to delete a specific file
0 Vote Up Vote Down
Barry asked 2 years ago

I’m using SPIFFS.remove(“/abc.txt”);
and it is not working.

Question Tags: spiffs delete
7 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
Can you provide your complete code?
Regards,
Sara

0 Vote Up Vote Down
Barry answered 2 years ago

I’ve tried a few different things to Del files, so far no luck. Possibly I’m not using the correct library.
https://www.tutorialspoint.com/esp32_for_iot/esp32_for_iot_spiffs_storage.htm
This example does compile, but does not delete the file. Immediately following the attemp to delete, I do a ESPrestart().

 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

You can try to format SPIFFS with the following example:
https://techtutorialsx.com/2019/02/24/esp32-arduino-formatting-the-spiffs-file-system/

Regards,
Sara

0 Vote Up Vote Down
Barry answered 2 years ago

The link you provided deletes ALL files. I have only a few specific files to delete.

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
The deleteFile function on the example you provided is the way to delete specific files files: https://github.com/espressif/arduino-esp32/blob/master/libraries/SPIFFS/examples/SPIFFS_Test/SPIFFS_Test.ino
 
Maybe you’re not entering the correct name of the file or the right path?
To double-check the name of the file you can try calling the listDir() function also defined in that example. Remember that uppercase and lowercase matter.
 
Regards,
Sara

0 Vote Up Vote Down
Barry answered 2 years ago

SOLVED!
Thank you for digging into this issue. It turns out the delete_file() function wasn’t being called properly. You must use the PATH “/abc.txt” for the file argument.
Thanks again.

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Great.
I’m glad everything is working now.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.