curl / curl

A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features
https://curl.se/
Other
34.74k stars 6.24k forks source link

curl: add --skip-existing #13993

Open bagder opened 5 days ago

bagder commented 5 days ago

With this option, the entire download is skipped if the selected target filename already exists when the operation is about to begin. Also works fine with "globs".

Ref: #11012

yedayak commented 3 days ago

This seems to empty the output file, instead of just doing nothing:

$ echo hello > foo.txt
$ cat foo.txt
hello
$ ./src/curl https://google.com -v --skip-existing -o foo.txt
Note: skips transfer, "foo.txt" exists locally
$ cat foo.txt
$
bagder commented 3 days ago

Oh. I'll check it out, that certainly looks wrong.

bagder commented 3 days ago

This seems to empty the output file, instead of just doing nothing:

Yeps, it did wrong - fixed now. I updated test 993 to verify the content of existing file after the transfer to make sure it does not do this anymore.

I also added test 995 to verify the case where the file does not exist before the transfer start.