Home/Support/Support Forum/How to create a list of files inside a dir
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to create a list of files inside a dir

0 votes
How can I create a list of files/dirs inside a specific dir?

I want to emulate the "ls" function.
asked Feb 11, 2015 in NET+OS by hsantana New to the Community (22 points)

Please log in or register to answer this question.

1 Answer

+1 vote
Best answer

You should look at API NAFSlist_dir(). It is used in conjunction with API NAFSdir_entry_count(). NAFSdir_entry_count returns the number of entries available. This is passed to NAFSlist_dir so that NAFSlist_dir knows how much space to allocate.

These are described in the API reference guide at:
System Software Services->File System->Flash File System->Functions.

Please ignore the fact that this is listed under Flash File System, it works equally well with the FLASH file and the RAM file system.
answered Feb 11, 2015 by dakotas_dad Veteran of the Digi Community (694 points)
selected Feb 11, 2015 by hsantana