µTasker Forum
µTasker Forum => utFAT => Topic started by: neil on March 09, 2015, 03:24:30 PM
-
Hi Mark,
I was thinking about using the ulListDir command to go through the whole sd card (trailing into directories and collecting files), is there a way to detect after the call if the entry is directory or a file? If so are there any variables that can get the file, or directory name ?
Thanks
Neil
-
Neil
To check the entry type you can use:
if (fileList.ucFileAttributes & DIR_ATTR_ARCHIVE) { // if a file
}
The list entry also contains some string details about the entry in the list buffer, where the name of file/directory string is present. From these details a pointer can be set to the start of the name (last entry in the string) as follows:
CHAR *ptrFileName = &cBuffer[fileList.usStringLength - fileList.ucNameLength]; // set pointer to null terminated file name
where cBuffer[] is the buffer that you configured for the listing to be placed into.
As reference see the SD card serial loader (in Kinetis project) which performs an optional wildcard file search using the methods above.
Regards
Mark
-
Hi Mark,
I dont have the Kinetis project, can you please email me the function that performs an optional wildcard file search?
Bets Regards
Neil
-
Hi Neil
I have attached the file involved - search for WILDCARD_FILES
Regards
Mark
-
Thanks Mark
Regards
Neil