µTasker Forum

µTasker Forum => utFAT => Topic started by: neil on March 09, 2015, 03:24:30 PM

Title: Information from utListDir command
Post 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

Title: Re: Information from utListDir command
Post by: mark on March 09, 2015, 03:52:45 PM
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

Title: Re: Information from utListDir command
Post by: neil on March 26, 2015, 10:14:14 AM
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
Title: Re: Information from utListDir command
Post by: mark on March 26, 2015, 05:38:24 PM
Hi Neil

I have attached the file involved - search for WILDCARD_FILES

Regards

Mark

Title: Re: Information from utListDir command
Post by: neil on March 26, 2015, 06:20:14 PM
Thanks Mark


Regards
Neil