SD Card file count

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
philg
 
Posts: 90
Joined: Sun Mar 06, 2011 4:42 pm

SD Card file count

Post by philg »

I have a working Wave Shield with a 256MB SD card that contains a number of .wav files at the root. Is there a function that will return the number of .wav files stored there? I have searched the .h files but the only thing close was rootDirEntryCount but that returns 512 and I only have about 30 files on the card.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: SD Card file count

Post by adafruit_support_mike »

The SD interface is fairly basic.

To list the files in a directory, you have to open the directory then call dir.openNextFile() until it runs out of files. The 'listfiles' sketch in the SD examples shows how it's done.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”