My objective is to iterate all files belongs to a specific filesystem and apply a callback function on each of them.
Currently, I'm doing so with a recursive C function that prints all the files from a specific folder and called recursively on sub-folders.
Unfortunately, I never manage to reach the total number of files contains by this mount as given by getmntinfo
, perhaps it's because some are not ready data regular files (meaning soft-links,pipes, sockets, etc..)
Is there any a high level objective-C framework for iterating all the data files from a specific mount point?
My ideal approach would be to iterate the files in ascending inode id, and not according to their location on the folder hierarchy.
I've found out that I can create file enumerator using enumeratorAtURL
but what If this URL/Path contain sub-folders that are mounted to remote filesystem .. I only interested in the containing mount files.
I would suggest you look at the C-level fts(3)
functions (Apple's documentation). These can be limited to a single device and provide the information needed to determine special files. Using them from Objective-C is straightforward.
HTH