sshtools / maverick-synergy

Next Generation Java SSH API
https://jadaptive.com
GNU Lesser General Public License v3.0
96 stars 26 forks source link

Is there a way to `ls` for a file directly and not have to be a directory? #35

Closed jamoros closed 2 years ago

jamoros commented 2 years ago

I'm using the ls command in the SftpClientTask but I get an exception that it is not a directory. Which is fine, as I was currently checking if its a file or not. What is the alternative to check for a file if it exists?

Thank you!!

ludup commented 2 years ago

That is what the stat method is for. It returns the attributes of the file so you can check its type or the isDirectory method of SftpFileAttributes.

jamoros commented 2 years ago

Thank you for your response, I will be trying that in my implementation this week.