6 years, 8 months ago.

How to get FAT file metadata (modification time)?

Hi,

I am using mBed 2.0 (MBED_LIBRARY_VERSION 93 to be exact) for writing and reading files from SD card.

How can I get the filestamp of an opened file?

Can I get the filename of the file, or is the path used only for opening it and then lost?

1 Answer

6 years, 8 months ago.

Hi Jakub,

I would try using the readdir() function within the FATFileSystem: https://os.mbed.com/teams/mbed-official/code/FATFileSystem/file/28e685e5ff7f/FATDirHandle.cpp/

Here's a forum comment with code that may help: https://os.mbed.com/forum/mbed/topic/800/?page=1#comment-3926

- Jenny, team Mbed

Accepted Answer

Hi there,

Just to update the thread that I successfully managed to get the metadata. I didn't use the "readdir()" function from MBED though, but directly a "f_readdir()" that's used inside to get the structure called FILINFO, Here's the reference: http://elm-chan.org/fsw/ff/doc/sfileinfo.html and http://elm-chan.org/fsw/ff/doc/readdir.html

Thanks for pointing me into the right direction!

posted by Jakub K 03 Apr 2018