Subject: Re: Getting filetype

Re: Getting filetype

From: double <ninive_at_gmx.at>
Date: Sun, 11 Apr 2010 08:43:39 +0200

Hi Jose,

You are right - thanks a lot!

Marcus

Jose Baars schrieb:
> Hi,
>
> On my system, this works:
>
> If you test attrs.permissions with S_ISDIR, you find out if it is a
> directory or not,
> like this :
>
> ....loop...
> rc = libssh2_sftp_readdir_ex(sftp_handle, mem, sizeof(mem),
> NULL,0, &attrs);
> if(attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) {
>
> printf("%s%x08 ", S_ISDIR(attrs.permissions)?"d":" "
> ,attrs.permissions);
> ...
>
> Good luck,
> Jose
>
>
>
> 2010/4/7 double <ninive_at_gmx.at <mailto:ninive_at_gmx.at>>
>
> Hi Heiner,
>
> Heiner Steven schrieb:
>
> Have a look at the libssh2_sftp_fstat_ex(3) manual page. the
> attributes
> are similar to what you'd expect in struct stat, stat(2)
> system call.
>
>
> Thanks a lot for your answer.
>
> "libssh2_sftp_fstat_ex()" returns this structure, but none of them
> contains
> the filetype:
>
> struct _LIBSSH2_SFTP_ATTRIBUTES {
> unsigned long flags; /* which of the down below
> elements are valid... */
> libssh2_uint64_t filesize;
> unsigned long uid, gid;
> unsigned long permissions;
> unsigned long atime, mtime;
> };
>
> In "stat()" you will have a element "st_mode", so you could
> check: S_ISDIR(buffer.st_mode)
>
> Thanks a lot
> Marcus
>
>
>
> _______________________________________________
> libssh2-devel
> http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-04-11