How do I read the file count on a mounted USB flash drive?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I read the file count on a mounted USB flash drive?

1,753 Views
ashbc1
Contributor III

I am running MQX4.2 and have built USB and MFS into my project.   A USB drive is interfaced OK and MFS installed.   I can read using 'read' a file so I am confident MFS is OK.   Is there a short way of reading the count of files in the present directory?

Labels (2)
3 Replies

1,567 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Ashley:

I would suggest you try IO_IOCTL_FIND_FIRST_FILE,IO_IOCTL_FIND_NEXT_FILE commands to search on the disk.  There is an example to list all files and sub directories in a directory. You can count the files in a specified directory.

pastedImage_1.png

Please refer to the MQX_MFS_User_Guide.pdf, section 3.8.1.8 for more details.

Regards

Daniel

1,567 Views
ashbc1
Contributor III

Thanks.  That's what I did in the end.   I was hoping there was a simple command as this is rather long winded just to get a file count.  Works though

0 Kudos
Reply

1,567 Views
danielchen
NXP TechSupport
NXP TechSupport

I agree with you it is long, but MFS does not provide a simple command as your expected.

0 Kudos
Reply