2014-05-07 06:08 AM
Does anyone know if there's a command to get the size of a directory in Chan's FATFS or will I need to go the directory and just tally up all the file sizes?
2014-05-07 06:22 AM
2014-05-07 07:25 AM
do you mean the
total size of files
in
a directory?
In
this case you can
use the code
http://elm-chan.org/fsw/ff/en/readdir.html and sum all the files sizebut I'm not
an expert on
FATFS
i don't
know if there's
a faster way
2014-05-07 08:49 AM
Well there are probably other methods to determine the ''size'' of the directory itself, but for files within the subdirectory, and those in subdirectories below, would need to be enumerated through them. Remember the files might have a 2GB limit, but as you accumulate you'll need to use a 64-bit variable for the total.
There can be empty entries, and long file names which take up multiple entries depending on the name length. FatFs is designed to be lightweight, you add features you need on top instead of having a bloated library for everyone.