Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jamoros opened this issue Dec 22, 2021 · 2 comments
Closed

Comments

@jamoros
Copy link

jamoros commented Dec 22, 2021

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
Copy link
Contributor

ludup commented Dec 22, 2021

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
Copy link
Author

jamoros commented Dec 25, 2021

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

@jamoros jamoros closed this as completed Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants