{"id":25326,"date":"2024-08-17T22:27:04","date_gmt":"2024-08-17T20:27:04","guid":{"rendered":"https:\/\/daniel.haxx.se\/blog\/?p=25326"},"modified":"2024-08-18T23:41:21","modified_gmt":"2024-08-18T21:41:21","slug":"skip-a-curl-transfer","status":"publish","type":"post","link":"https:\/\/daniel.haxx.se\/blog\/2024\/08\/17\/skip-a-curl-transfer\/","title":{"rendered":"skip a curl transfer"},"content":{"rendered":"\n<p>This is episode three in my mini-series of posts describing news in the coming <a href=\"https:\/\/curl.se\/\">curl<\/a> 8.10.0 release. Part one was <a href=\"https:\/\/daniel.haxx.se\/blog\/2024\/08\/09\/more-curl-help\/\" data-type=\"post\" data-id=\"25272\">more help<\/a>, part two <a href=\"https:\/\/daniel.haxx.se\/blog\/2024\/08\/12\/verbose-verboser-verbosest\/\" data-type=\"post\" data-id=\"25324\">verbose, verbose and verbosest<\/a>.<\/p>\n\n\n\n<p>This new command line option in curl 8.10.0 is a simple one that has been requested by users repeatedly over the years so I figure it was about time we actually provide it.<\/p>\n\n\n\n<p><em>If the target file already exists on disk, skip downloading it.<\/em><\/p>\n\n\n\n<p>It is exactly as simple as that. No date check, no size check, no checking if the file is even what you want it to be. If the target file is present and exists that is a signal enough that the file should not be downloaded; to skip the transfer.<\/p>\n\n\n\n<p>A real-world command line using this feature could then look like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl --skip-existing --output local\/dir\/file https:\/\/example.com<\/pre>\n\n\n\n<p>Or if instead -O is used, it still works the same:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl --skip-existing -O https:\/\/example.com\/me.jpg<\/pre>\n\n\n\n<p>Easy, right? See the <a href=\"https:\/\/curl.se\/docs\/manpage.html#--skip-existing\">manpage<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Broken files can also be present<\/h2>\n\n\n\n<p>To avoid a previous broken download remainder to linger around and cause future transfers to get skipped, remember that curl also has a <a href=\"https:\/\/daniel.haxx.se\/blog\/2022\/03\/11\/remove-leftovers-on-curl-error\/\" data-type=\"post\" data-id=\"18531\">&#8211;remove-on-errror<\/a> option.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ships<\/h2>\n\n\n\n<p>In curl 8.10.0, on September 11, 2024.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Image<\/h2>\n\n\n\n<p>From a movie with a suitable if even perhaps subtle reference.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is episode three in my mini-series of posts describing news in the coming curl 8.10.0 release. Part one was more help, part two verbose, verbose and verbosest. This new command line option in curl 8.10.0 is a simple one that has been requested by users repeatedly over the years so I figure it was &hellip; <a href=\"https:\/\/daniel.haxx.se\/blog\/2024\/08\/17\/skip-a-curl-transfer\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">skip a curl transfer<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":25410,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[214,33],"class_list":["post-25326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-curl","tag-command-line","tag-curl-and-libcurl"],"_links":{"self":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/25326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/comments?post=25326"}],"version-history":[{"count":12,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/25326\/revisions"}],"predecessor-version":[{"id":25419,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/25326\/revisions\/25419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media\/25410"}],"wp:attachment":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media?parent=25326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/categories?post=25326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/tags?post=25326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}