in reply to -f over Net::SFTP
Having read the documentation, I see there is no documented way of discerning a file from a directory (and I don't know how it's done via SFTP). One reasonable way of guessing is by examing the size attribute. On my server, directories are always listed as 4096 bytes in size. I'm guessing the flags and mode ought to be more revealing, but I don't have Net::SFTP installed to try so I can't say for sure.
update: I think this ought to do it (its worth a try)
... use Fcntl ':mode'; my $a = $sftp->do_stat($path); warn "$path is a directory " if S_ISDIR($a->perm);
|
|---|