Will this use up the lifetime of the directory area of the SD unnecessarily? (note I am not worried about the data area itself just the directory)
The alternative would be to search for the filename every 10 sec and only create a new one if the filename had changed to the one for the next day.
I'd rather not have the extra code as I predict that I may run out of program RAM with all the other code I want to include eventually.
Will this use up the lifetime of the directory area of the SD unnecessarily? (note I am not worried about the data area itself just the directory)
"The directory" would be the File Allocation Table. Opening the same file over and over doesn't cause a write to the FAT. Creating a new file, deleting a file, etc. does.
I don't think you should be doing that. That code is for creating the filename. You are attempting to create a new file every ten seconds. This can't be a good idea and surely only needs to be done once a day. The stroke of midnight might be a good place.
so loop:
get time
if midnight or just after
create filename
get data
open file
write data
close file
tralala
I think what happens is that: if a file log.csv exists and you try to create another of that same name, Arduino just ignores you. So no harm done, but it's still not a good idea. What this means is that you don't have to wait till midnight either. You can create the file in the setup by calling the same subroutine and, in the event of a restart, data will be immediately written to the right file.