Hi,
I am using JSCH to implement SFTP client, and got two problems as something
below, Thanks for having a look.
my code:
JSch jsch = new JSch();
Session session = jsch.getSession("*****", "*********", 22);
session.connect();
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp sftpChannel = (ChannelSftp) channel;
1. Get type (regular file or symbol link or directory) of remote file.
Firtstly I use ChannelSftp.stat(), like :
SftpATTRS nodeAttr = sftpChannel.stat("A-Symbol-Link-Of-Unix");
//remote file is a symbol link
if ( nodeAttr.isLink() ) {
...
}
the method isLink() always return false, and give the type of real path
at which that symol link points.
Then I try ChannelSftp.lstat(), like:
SftpATTRS nodeAttr = sftpChannel.lstat("A-Symbol-Link-Of-Unix");
//remote file is a symbol link
if ( nodeAttr.isLink() ) {
...
}
The method isLink works well.
Does this mean I need to use ChannelSftp.lstat rather than
ChannelSftp.stat, when remote target is a symbol link under Unix OS ?
2. How could I get the owner of file
I did not find method in class SftpATTRS.
Thanks a lot!
Regards,
-----------------------------------------------------------------------
Chen Xiaolei(陈小磊)
oambase-wtk Team
Telephone: +86 10 8477 7636
Mail: [email protected]
-----------------------------------------------------------------------
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users