How to check the existence of the directory before creating a new directory using JSCH SFTP API? I am trying to use lstat but not sure it’s doing the job that I need.Thanks in advance
How to check the existence of the directory before creating a new directory using
Share
In situations like this it is always better to just do the create and handle the error. That way the operation is atomic, and in the case of SSH you also save a lot of network traffic. If you do the test first, there is then a timing window during which the situation may change, and you have to handle error results anyway.