How to identify whether the item of a directory is a file or a directory using Net::SFTP
or ruby code?
views:
67answers:
2
+5
A:
The do_stat
method seems like it could get you that information. See also the documentation for Net::SFTP::Attributes
and perldoc -f stat
.
innaM
2009-11-26 13:42:39
+4
A:
To illustrate the use of Manni's recommendation:
use Fcntl(:mode);
my $permissions = $sftp->do_stat($path)->perm();
my $is_directory = S_ISDIR($permissions);
Adam Bellaire
2009-11-26 13:54:31