I'm using the Net::SSH2 library for specific reasons. If I wish to copy a file from a remote host to local client, I can use scp_get() but this function won't do directory copies (and certainly not recursive copy). So I need to check before copying if a file is a dir or symlink etc. In perl its easy with file test operators. But they don't work with files on a remote host!
So I'm trying to use Net::SSH2::SFTP->stat() on each file to determine it's type. I see it returns an argument 'mode' which usually gives me an integer 16877 for directories, and 33188 for regular files. All I can think is that these are codes of some sort relating to the permissions. But the docs are scant on this. If it really is the case that directories ALWAYS return this value, then I can use this as a file test operator, but I'm very hesitant to do this without checking on other systems.
Any suggestions would be greatly appreciated!
James
In reply to Net::SSH2::SFTP stat function by james_
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |