tags:

views:

60

answers:

3

Hi,

How can i get the paths of a folder and its content. Say i have folder named MyFolder as

/tmp/MyFolder/ where it has subfolders SubFolder1, SubFolder2... and some files

+1  A: 

You may take a look at the opendir() family functions.

ereOn
@ereOn Thanks for your help. Even though i am using some other related functions under the same framework...
iSight
A: 

Use dirent and dir structures. You can use opendir(), readdir() etc for manipulation.

readdir() will give one name at a time and you can keep calling it iteratively.

Jack
+1  A: 

A more efficient way than {open,read,close}dir() is Linux' getdirentries() function. See getdirentries(3) for details.

anselm
I think that is linux centric, the OP is asking about Mac OS/X.
Tim Post