2019-11-26 12:36 AM
Hello
I am woking on STM32F779BI controller
I am working with sd card .
I am getting size of text file using f_size(fp) , but how can we get size of folder(Directory)
Best Regards
Dipak Garasiya
2019-11-26 01:33 AM
Should be able to infer from structures.
Typically non-root will allocate a cluster at a time, and each entry takes 32 bytes. Problem is LFN will consume multiple and variable number of records. If you want a file count you'll need to enumerate.
2019-11-26 01:37 AM
Thanks for reply
2019-11-26 01:41 AM
which function or stucture i could use for this
2019-11-26 01:42 AM
i have used structure : FILINFO
but could only be able to give size of file only (text file)
i could not find size of folder(directory)
2019-11-26 02:18 AM
I think you have to walk the cluster chain to see how many it owns.
What "size" are you trying to determine? Number of files, folders, bytes, or something else? The FATFS layer doesn't walk the directory automatically as it is time consuming.
Liking your own posts isn't necessary.
2019-11-26 02:24 AM
I am capable to read number of files and folders in sd card using of f_opendir and f_readdir
i could print list of files and folders of sd card on terminal
but want to also print the size of each folder and file also
file size is done by me but not able to find size of folder in (like in bytes)
Thanks for replying
2019-11-26 02:33 AM
When cataloguing I build tables from the folder content, and then traverse the subfolders.
The allocation unit for a directory is a cluster, you have to chase the chain to determine how many clusters it contains, this isn't tracked/updated in the parent record.
2019-11-26 02:34 AM
i also want to inform you that
i have find
total size ,available size and free size of sd card use of
f_getfree
function which give number of free clusters.
2019-11-29 08:50 PM
Thanks for support
I am capable to find size of directory by followring sbu folder and files included in that