In my code, I'm using readdir to get the listing from a directory. Not sure the difference, maybe you can tell me - I haven't looked at this in a while.
When you have the filename, you can run the stat command on it. After that, you can use the S_ISDIR macro as in:
I hope that helps and does what you want. Let me know if something isn't quite right, but this works for me and has been in production for years. WARNING: The stat command can error off if the system resources are very heavily loaded - it happens occasionally on the HP boxes we run on.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.