SD file renaming.

Hi,

Most of my arduino projects write to a logfile on an SD card, and rather than accumulating one very large log file, I'd like to use one file per boot-up (hope that makes sense). So each time the device boots, it makes a note of the current time and uses this to create a filename for the error log.

Most of my projects get their time from a GPS unit, and most of them take 10-15 seconds to acquire the date and time. So for the 1st 10-15 seconds all messages and errors get logged to a default log file, "logger.txt", and once the current time is known, the system stops, creates a new file (based on the current time) copies the old data line by line from one file to the other. Then it deletes "logger.txt" and the project continues but this time logs to new file.

This works, but it's a rather long and convoluted process, plus it can take several seconds to run (my projects accumulate a lot of errors!)

Is there a simpler/quicker/better way of doing this? I've spotted a few post about SD file renaming (many of them quite old) and none of them seem to suggest there as simple way of doing this. Have things changed recently?

Thanks

I doubt it, it probably always was simple. It is just a case of regularly checking the time and, if appropriate, using that time or date as a filename. An example is at.

http://homepages.ihug.com.au/~npyner/Arduino/Bluetooth_graphic_5110_with_file_retrieve_DY.ino

in which a new file is created at midnight and the vital srtn is

void getFileName(){
sprintf(filename, "%02d%02d%02d.csv", year, month, day);
}