How to decide the file type in Cygwin?

Randall R Schulz rrschulz@cris.com
Tue Mar 25 02:52:00 GMT 2003


Yang,

Unix file systems don't store the the type of a file system entity in 
the directory entry used to access that entity, they stored in the 
so-called "inode." Once you have a name, use the stat(2) system call to 
get its inode information. From there you'll be able to determine what 
kind of an entity it is. If you have a file descriptor, then fstat(2) 
will do the same.

Randall Schulz


At 15:27 2003-03-24, Yang, Huaichen wrote:
>I need to list all files in a folder (including sub-folder,
>recursively), and I tried some sample codes in GNU C manual, as
>follows:
>
>...
>
>The sample was working. Then I added some codes to check the
>ep->d_type (the type of the file). If it was a directory, the
>program would check the sub-folder recursively. However, I
>encountered a compiler error. The property d_type was not defined
>in the Cygwin header file dirent.h. It seems that we cannot
>distinguish the files from the directories. Is that true? Doesn't
>anybody have a good idea to do this?
>
>Thank you very much in adavance!


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list