My data is 26 bytes each minute
So, the Arduino should be able to save 10 minutes worth of data, while uploading the contents of the SD card (that was saved while the internet was not available).
Surely that's enough time to copy the whole file to the server. There would then be no reason to copy/remove/copy/rename just to remove one line from the file.
I'm trying to make additional files using some files like 0001.txt, 0002.txt with 1 hour of data each. But I'm finding a hard way dealing with ls() method. Can you post some example on dealing with this like ls, open first file, close, another file and so on?
Post a link to the library you are using. Post the code that you wrote to test the ls() method.
You could try to open hourly file. If it succeeds, that file already exists. Close it, and try the next number. When you get a failure, that file doesn't exist, so, create it and write to it.