SD Card
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-30 9:49 AM
Hi,
I'm using the cubeF4 to work on FATFS application and i'm searching for a function in FATFS library that can return the content of the SD Card: number of files and their names.
Thank you.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-04-03 6:25 AM
Thank you all, all your suggestions were helpful
I saved files in a directory created in the SD Card and i just used the function '
f_readdir'
into a loop to count files in my directoryf_opendir (&dir,'mydirectory');
while (1)
{ res_dir = f_readdir(&dir, &fno); if((res_dir==FR_OK)&&(fno.fname[0]!= 0)) { nb_file_dir++; }}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-30 10:12 AM
You'll have to write such code, the FATFS library provides functions like f_opendir, f_readdir, you'd use these to process and count files in the current directory, and you'd need recurse and descend into the directories you encounter at each level.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-30 10:21 AM
Hi,
There is FatFs_uSD example on STM32CubeF4 firmware package that can help you to use most of the features offered by FatFs and to configure a microSD drive.
You can get help from the User manual UM1721'Developing Applications on STM32Cube with FatFs'
Imen
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-31 3:11 AM
Thank you, i'll understand more FATFS functions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-31 3:13 AM
Thank you Imen, i'm already working with the
FatFs_uSD example, i'll see this manual.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-31 6:15 PM
http://elm-chan.org/fsw/ff/en/readdir.html
the code example doesn't print the count, but it does walk the directory tree and print the contents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-04-03 6:25 AM
Thank you all, all your suggestions were helpful
I saved files in a directory created in the SD Card and i just used the function '
f_readdir'
into a loop to count files in my directoryf_opendir (&dir,'mydirectory');
while (1)
{ res_dir = f_readdir(&dir, &fno); if((res_dir==FR_OK)&&(fno.fname[0]!= 0)) { nb_file_dir++; }}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-04-03 9:31 AM
That will also count sub-directories, you should also check the attributes.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-04-11 9:02 AM
My SDcard is 8GB with one directory where i save files from the F4 discovery and it works well. Now i faced some problems, i added an other directory (2.6Gbyte) in the sd card and it's not related to the first one. when i save new files in the first directory i notice that the old ones are overwritten with 'UUUUUU...'. Did you know this issue please? I can't understand why they are modified even though i didn't opened any of them with the stm32 i just count the number of the existing files in the directory and then i create new ones
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-02-02 11:32 AM
Hi @nechi
I did pretty much the same thing, but I want to create a file with the name of how much files there are in the directory, for that reason I didn't put the code in the while. Here's the code:
