#include<SD.h>Fileroot;voidsetup(){Serial.begin(9600);pinMode(10,OUTPUT);SD.begin(10);root=SD.open("/");printDirectory(root,0);Serial.println("done!");}voidloop(){// nothing happens after setup finishes.
}voidprintDirectory(Filedir,intnumTabs){while(true){Fileentry=dir.openNextFile();if(!entry){// no more files
//Serial.println("**nomorefiles**");
break;}for(uint8_ti=0;i<numTabs;i++){Serial.print('\t');}Serial.print(entry.name());if(entry.isDirectory()){Serial.println("/");printDirectory(entry,numTabs+1);}else{// files have sizes, directories do not
Serial.print("\t\t");Serial.println(entry.size(),DEC);}}}