I'm working on a hobby PCB which has an STM32F401CBU6 that interfaces with a micro SD card over SPI and uses FATFS. I've successfully written and read files from the SD card however I'm having trouble reading the file metadata i.e. size, name etc. Here's the code I'm running.
FATFS fs;
FRESULT fres;
DIR dir;
FIL fil;
FILINFO meta;
char mess[1024];
HAL_Delay(3000);
fres=f_mount(&fs, "/", 0);
f_opendir(&dir, "/");
HAL_Delay(100);
fres=f_readdir(&dir, &meta);
if(meta.fname[0] != 0){
sprintf(mess,"Found file: %s\n", meta.fname);
CDC_Transmit_FS(mess, strlen(mess));
}
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_2, 1);
f_closedir(&dir);
I've written one file to the card called "Test.txt" and it's size is 18 bytes.
When I run this I get the following in RealTerm. 
For some reason I get this odd string "System Volume Information". I'm not sure why this is happening as the code I'm running is essentially identical to most other examples online. It also reads 0 bytes for file size. fres is however returning FR_OK at the line where I call f_readdir(). Any ideas where this may be going wrong? Thanks in advance.