I snipped some stuff to illustrate the problem:
boolean PublierListeFichiers(char* path,EthernetClient client)
{
File myDir, entry;
myDir=SD.open(path,FILE_READ);
entry = myDir.openNextFile();
while(entry)
{
Serial.println(entry.name());
entry = myDir.openNextFile();
}
//close files
myDir.close();
entry.close();
}
You open the directory. Then, you open each file in the directory. Then, you close the last file opened, and close the directory. Pretty soon, you run out of file handles.
You need to close each file BEFORE you open the next one.