1

I need to check whether a remote directory exists or not on sFtp connection.

I am using the condition like,

if (!sftp.Exists(remotePath))

I am using the library ssh2-sftp-client but it doesn't allow me to use the Exist methods because it doesn't have that function.

Can anybody suggest me what should I do for checking for remote directory exist or not?

vimalDev
  • 412
  • 1
  • 4
  • 25

1 Answers1

0

Use list

sftp.list(remotePath);

It will (asynchronously) trigger an error if the file doesn't exist

blue112
  • 52,634
  • 3
  • 45
  • 54