This is my first time using Curl. I'm writing a script that automatically checks my SFTP server for updated/new images, and downloads any it finds.

The primary curl statement is:

curl -z 06-Nov-2018 -k -u $USER:$PASSW --remote-name-all sftp://$HOSTNAME/$PATH/image[1-9].jpg

My issue is that the -z /--time-cond flag does absolutely nothing. This date should prevent it from downloading anything at all, and yet every file is downloaded. I've tried dozens of dates, including -06-Nov-1994, to no avail. Does curl not support the -z option over SFTP, or am I doing something wrong?

I'm basing my date on the man page found here. It says it's for curl 7.12.2+, I'm on 7.51.0 so that shouldn't be an issue.

$ curl --version
curl 7.51.0 (x86_64-w64-mingw32) libcurl/7.51.0 OpenSSL/1.0.2j zlib/1.2.8 
libssh2/1.8.0 nghttp2/1.16.1 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 
pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz TLS-SRP HTTP2 

P.S. Does the -k option send my login info over plaintext? I'm assuming not since it's still SFTP, but I have absolutely no idea.


So I submitted an issue on the curl github page, and it turns out "There's no support for time conditional transfer with SFTP in curl." Only HTTP and FTP.


Oh well. I'll see if I can implement it myself but honestly I'm in a time crunch and will probably just make a quick fix.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.