cancel
Showing results for 
Search instead for 
Did you mean: 

How to Find File Names in a Directory Using FileX.

Hey0256
Associate II

Hello, everyone on the forum.

I am using ThreadX and FileX to write files to an SD card on the STMH735G-DK.

I successfully created a directory using fx_directory_create and created a file using fx_file_create.

This time, we'll tackle directory deletion using fx_directory_delete.

However, if the directory contains files, deletion will fail with error code FX_DIR_NOT_EMPTY.

How can I search for filenames within a directory using FileX?

If anyone knows anything, please give me some advice.

1 ACCEPTED SOLUTION

Accepted Solutions
Hey0256
Associate II

Using `fx_directory_next_entry_find` to retrieve entries,

`fx_directory_name_test` to check if they are directories,

and `fx_file_delete` to delete files until the return value `FX_NO_MORE_ENTRIES` is returned,

I successfully deleted the directories.
Thank you for your advice.

View solution in original post

2 REPLIES 2
TDK
Super User

fx_directory_first_entry_find
fx_directory_first_full_entry_find

fx_directory_next_entry_find
fx_directory_next_full_entry_find

From:

Solved: filex file list - STMicroelectronics Community

If you feel a post has answered your question, please click "Accept as Solution".
Hey0256
Associate II

Using `fx_directory_next_entry_find` to retrieve entries,

`fx_directory_name_test` to check if they are directories,

and `fx_file_delete` to delete files until the return value `FX_NO_MORE_ENTRIES` is returned,

I successfully deleted the directories.
Thank you for your advice.