Due. Very Slow File Copy.

I have a simple routine that appends the data from one file to an Archive file.

Although the routine works fine. It is incredibly slow.

Almost a minute to Copy 10K

snippets::::

SPI.setClockDivider(4);
File Fin; // DATA FILE
File Fout; // Archive File

Fin= SD.open("DATA.S3D",FILE_READ);
if(Fin)
{
Fout= SD.open("ARCHIVE.S3D",FILE_WRITE);
while(Fin.available()) { Fout.write(Fin.read()); }
Fout.flush();
Fin.close();
Fout.close();
SD.remove("DATA.S3D");

}

Is there anything I can do to speed this up?

Is there anything I can do to speed this up?

Of course. Read more than one character at a time. Write more than one character at a time.

Is there a command for that.

The Sd Library only shows a SD.read that returns a byte.

I do see a writeln function but nothing like a readln.

The Sd Library only shows a SD.read that returns a byte.

There are two versions of read() - one that returns a byte and one that populates an array. Look at the header file and source code, not the "documentation".

The write() method is similarly overloaded.

Awesome. Thank you