Program to clear files from root when SD Card is full

Hello, is it possible to code something like when SD Card is full, clear specified files in the root to get some space? I've been searching for something like this but i can't find nothing that talks about it. If possible can you please show me an example to see the schematic to how to do it?

Thanks in advance!

The SD class has two methods, remove() and rmdir(), that look useful.

The CardInfo example shows how to determine the card size.

The listfiles examples shows how to find all the files on the card.

It should not be too difficult to cut and paste code to create a function to determine if the card is full, within your definition of full. It should not be too difficult to determine what file(s) to delete.

If you name files based on date, for instance, you could delete the oldest files first. If you create files in directories by year, month, etc. it should be easy to make a bunch of space very quickly.

I use sdfatutil.h library. Do i need to use another library? Could you provide me some page or documento to look at the commands like you suggested for me to understand what they do and how to use them?

Thanks for reply

  2. Click on libraries (bottom right corner):
  3. Click on SD:

Ok, thank you all. :D