saswat wrote: > On Aug 28, 3:11 pm, Christian Heimes wrote: >> [EMAIL PROTECTED] wrote: >> > File symLinkTest is a symbolic link. >> >> > Why S_ISLNK(mode) returns False and S_ISREG(mode) returns True ? >> >> Because you are using os.stat() instead of os.lstat(). > > Do you mean the following is deprecated ? > http://docs.python.org/lib/module-stat.html > > >From the documentation - > > S_ISLNK( mode) > Return non-zero if the mode is from a symbolic link.
No, it means that os.stat follows the symbolic link and gives stat information for the file that the symbolic link points to, which is *not* a symbolic link. Like the documentation for lstat says: "Like stat(), but do not follow symbolic links." But why not just use os.path.islink? -Miles -- http://mail.python.org/mailman/listinfo/python-list