Yes SD can open more than 1 file at a time, with sketch.

I had a wiring problem so I didn’t get this out for someone the other day.

Tested, working, SD with 2 files open, reads from one and writes to the other in loop.
It’s not the best or cleanest code but it shows that 2 files works.

I am sure that multiple open files were available years ago but when I went to find mention of it, I found none! What I did find is OLD DOC and COMMENTS saying Just One File Allowed and that is what new people see!

/*
  SD card read/write --- Modified to work with 2 files at once. Feb 15, 15.
 
 This example shows how to read and write data to and from an SD card file 	
 The circuit:
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 4
 
 created   Nov 2010
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe
 
 This example code is in the public domain.
 	 
 */

#include <SD.h>

File meFile;
File myFile;

// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
// Teensy 2.0: pin 0
// Teensy++ 2.0: pin 20
const int chipSelect = 10;

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin 
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output 
  // or the SD library functions will not work. 
  pinMode(10, OUTPUT);

  if (!SD.begin(chipSelect)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.

  byte ch;
  ch = SD.remove( "test.txt" );
    Serial.print("remove test.txt ");
    Serial.println( ch );
  ch = SD.remove( "text.txt" );
    Serial.print("remove text.txt ");
    Serial.println( ch );
//  
  meFile = SD.open("text.txt", FILE_WRITE);
  if (!meFile) {
    Serial.println("error opening text.txt");
//    return;
  }

  myFile = SD.open("test.txt", FILE_WRITE);
  if ( !myFile )
  {
    Serial.println("error opening test.txt");
    return;
  }
  Serial.print("Writing 2 files...");
  myFile.println("testing 1, 2, 3.");
  meFile.println("testing 4, 5, 6.");
  myFile.close();
  Serial.println("done.");

  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (!myFile) {
    Serial.println("error re-opening test.txt");
    return;
  }
  
  Serial.println("copy test.txt:");

  // read from the file until there's nothing else in it:
  while (myFile.available()) 
  {
    ch = myFile.read();
    meFile.write( ch );
    Serial.write( ch );
  }
  
  myFile.close();
  meFile.close();
  Serial.println( "\n copies data\n" );

  meFile = SD.open("text.txt");
  if (!meFile) {
    Serial.println("error re-opening text.txt");
    return;
  }
  
  Serial.println("copy text.txt:");

  // read from the file until there's nothing else in it:
  while (meFile.available()) 
  {
    ch = meFile.read();
    Serial.write( ch );
  }
  // close the file:
  meFile.close();
}

void loop()
{
  // nothing happens after setup
}

I am sure that multiple open files were available years ago but when I went to find mention of it, I found none! What I did find is OLD DOC and COMMENTS saying Just One File Allowed and that is what new people see!

fat16lib developed the library. Over it's life, changes have been made. The first version did not support multiple files open at one time. The current version does, but it is important to remember that EACH open file requires a 512 byte buffer.

I’m pretty sure that the buffer size is settable. 512 is very DOS-FAT friendly though.

At 512 bytes x 2, I wouldn’t want to get too ambitious but there’s still room on an UNO to do a lot.

Anyway, I want new people to know that they can keep mass data on SD and use it to write output, could you imagine trying to write index files while not being able to keep the data file open?

For new programmers, don’t sort SD files on SD. Learn to write sorted indexes to data on SD.

I write to data file. Close it. Open index file, write index, close it. Any time you keep a file open beyond your current write or read commands, you open yourself up for file corruption. It s less efficient but also less corruption.

Is the library buggy?

GoForSmoke: For new programmers, don't sort SD files on SD. Learn to write sorted indexes to data on SD.

Would you mind expanding on that a bit?

You leave the on-storage data in its natural order (which generally means appended to the end of the file; chronological order). If you need the data sorted, you create a data structure in memory that includes the key and an index into the file. Optionally, you write the data structure to an index file. Classic dBASE # approach.

# The approach undoubtedly predates dBASE but I’m too lazy to find a more accurate reference.

GoForSmoke: Is the library buggy?

If you mean "why are you concerned with data corruption?", then no the library works fine. It is just unexpected events such as power loss (cloudy all day so solar panel doesn't charge battery), program freezing (bug or some unexpected things), and other stuff that may prevent a file from closing. By closing files right after I finish writing to them, I minimize corruption due to unexpected events.

I'm not worried then. I would know there's a problem. I've written fault-tolerant software that logged. It even logged power-outs after the fact.