Home > Software design >  curl to SFTP and list files in directory
curl to SFTP and list files in directory

Time:11-19

I am using the below curl command in my shell script to connect to SFTP remote directory.

curl -k "sftp://url.test.com/test_folder" --user "username:password"

Is there a way to list the files in directory test_folder.

CodePudding user response:

Yes: end the URL with a trailing slash, to indicate to curl that it is in fact a directory! Like this:

curl -k sftp://url.test.com/test_folder/ --user "username:password"
  • Related