Listing files on sd card

Hi,

I am creating an arduino program that lists the files inside an sd card, using the micro sd module

This is my code :

#include <SD.h>
#include <SPI.h>

int sdpin=10;

void setup()
{
  Serial.begin(9600);
  pinMode(sdpin, OUTPUT);
  if (SD.begin())
  {
    File root = SD.open("/Music");
    printFiles(root,0);
  }
}

void loop()
{
	
}

void printFiles(File dir, int numTabs)
{
  while (true)
  {
    File entry =  dir.openNextFile();
    if (! entry)
    {
      break;
    }
    for (uint8_t i = 0; i < numTabs; i++)
    {
      Serial.print('\t');
    }
    Serial.println(entry.name());
    entry.close();
  }
}

The program lists the file but it doesn't display the file names correclty

This is s screenshot of the Music folder :

This is how the files show up when i plug the sd to my computer :

I don't know why the name() functions doesn't return the correct file name

Thanks in Advance

The SD library can only do 8.3 names. It can't handle those long file names like Windows can. There may be other options, but I know you can't do it with the stock SD library.

Thanks for your answer

I just knew about SdFat and i will try it