SD card read files

How can I detect an SD card if card is empty or not using arduino that reads from the SD card. If yes how can I read the number of lines inside a file?

How can I detect an SD card if card is empty or not

The SD library comes with an example to list all the data on a card. Modify that example to count the files.

If the count is zero...

If yes how can I read the number of lines inside a file?

There are no lines in a file. A file is a stream of bytes. Some of those bytes might be interpreted, under some circumstances, as end of record makers. Read all the data in the file, and count the bytes that are whatever you consider an end of record marker.

is it the ListFiles example?

bembe24: is it the ListFiles example?

Yes.

thank you i got it know :wink: