Hi,
I am working with KDS and developing a project with Processor Expert. I am using MK60DN512VMD10 controller.
In my project I want to arrange file in SD Card in such a way that last modified file will be last.
Which functions I have to use to this sorting ? Please suggest.
Regards
Utsavi Bharuchala
Not sure what you mean with arranging the files. If it is about having them sorted in a way for the directory listing, you certainly could implement that: retrieve the list of files and then sort it according to your criteterias.
I hope this helps,
Erich
Hi Erich,
Say I have files named as,
Data0010001.dat, //date of modified is 22-08-2017
Data0020002.dat //date of modified is 22-08-2017
Data0030003.dat //date of modified is 22-08-2017
Data0040004.dat //date of modified is 22-08-2017
Data0050005.dat //date of modified is 22-08-2017
Data0060006.dat //date of modified is 22-08-2017
Data0070007.dat //date of modified is 22-08-2017
Data0080008.dat //date of modified is 23-08-2017 <---File Modified today
(format 1)
What I want to know is, Data0080008.dat , which is latest modified file, will be placed at last in sdcard folder(as per format 1) or it will be placed first (as per format 2)?
Data0080008.dat //date of modified is 23-08-2017 <---File Modified today
Data0010001.dat, //date of modified is 22-08-2017
Data0020002.dat //date of modified is 22-08-2017
Data0030003.dat //date of modified is 22-08-2017
Data0040004.dat //date of modified is 22-08-2017
Data0050005.dat //date of modified is 22-08-2017
Data0060006.dat //date of modified is 22-08-2017
Data0070007.dat //date of modified is 22-08-2017
(format 2)
I want lastest modified file to be placed last in sd card folder (as per format 1). What is the default format in sdcard?
These files all have the same name?
You cannot have files with the same name in the same folder. If you need files with the same name, you need to put them into separate directories on the file system.
Erich
No No Erich , I modified my reply which was by mistake saved and post.I post it correctly and now it is under "currently being moderated"
I recommend you have a read at FatFs - f_readdir and other items on that web site. Bottom line is that this is up to the file system you are using, and at least for f_readdir you have no influence on the order: it will be initially probably in the order you have created the files, but as soon as files get deleted/etc things might change.
If you need them in a given order, you have to read the entries and sort them.
Erich
Hello Utsavi Bharuchala
If you want to use processor expert. I suggest you refer this document from Erich
https://mcuoneclipse.com/2014/04/09/ftf-frdm-k64f-kinetis-design-studio-and-kinetis-sdk/
This demo uses file system but you can simply remove Fat_FileSystem component, then you can also access to the card without file system.
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------