Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl to SFTP and list files in directory

Tags:

shell

curl

sftp

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.

like image 521
Padfoot123 Avatar asked Dec 10 '25 04:12

Padfoot123


1 Answers

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"
like image 98
Daniel Stenberg Avatar answered Dec 14 '25 09:12

Daniel Stenberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!