in reply to Re: Net::SSH2::SFTP stat function
in thread Net::SSH2::SFTP stat function
use Fcntl ':mode'; my $mode = ...; if (S_ISDIR($mode)) { # directory ... }
But still no joy. It simply doesn't enter the "if" block, even though I'm doing a stat on a directory. I suspect it's got something to do with the fact that the files (and dirs) are on a remote host. Anyway, reading the docs on the builtin stat has shown me how to get the permissions, i.e.
my $ssh2 = Net::SSH2->new(); my $sftp = $ssh2->sftp(); my %fstat = $sftp->stat("${testdir}"); my $perm = $fstat{"mode"} & 07777;
But is there no way to get the file type in the same way, i.e. using an & operator on the mode?
Many thanks..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Net::SSH2::SFTP stat function
by salva (Canon) on Oct 02, 2008 at 12:47 UTC | |
by Anonymous Monk on Oct 02, 2008 at 13:25 UTC |