{"id":13719,"date":"2020-04-13T23:11:04","date_gmt":"2020-04-13T21:11:04","guid":{"rendered":"https:\/\/daniel.haxx.se\/blog\/?p=13719"},"modified":"2020-04-13T23:11:04","modified_gmt":"2020-04-13T21:11:04","slug":"curl-ootw-append","status":"publish","type":"post","link":"https:\/\/daniel.haxx.se\/blog\/2020\/04\/13\/curl-ootw-append\/","title":{"rendered":"curl ootw: &#8211;append"},"content":{"rendered":"\n<p><a href=\"https:\/\/daniel.haxx.se\/blog\/2020\/01\/07\/curl-option-of-the-week\/\">Previously mentioned command line options of the week<\/a>.<\/p>\n\n\n\n<p><code><a href=\"https:\/\/curl.haxx.se\/docs\/manpage.html#-a\">--append<\/a><\/code> is the long form option, <code><a href=\"https:\/\/curl.haxx.se\/docs\/manpage.html#-a\">-a<\/a><\/code> is the short. The option has existed since at least May 1998 (present in curl 4.8). I think it is safe to say that if we would&#8217;ve created this option just a few years later, we would not have &#8220;wasted&#8221; a short option letter on it. It is not a very frequently used one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Append remotely<\/h2>\n\n\n\n<p>The append in the option name is a require to the receiver to append to &#8212; rather than replace &#8212; a destination file. This option only has any effect when uploading using either FTP(S) or SFTP. It is a flag option and you use it together with the <code><a href=\"https:\/\/curl.haxx.se\/docs\/manpage.html#-T\">--upload<\/a><\/code> option.<\/p>\n\n\n\n<p>When you upload to a remote site with these protocols, the default behavior is to overwrite any file that happens to exist on the server using the name we&#8217;re uploading to. If you append this option to the command line, curl will instead instruct the server to append the newly uploaded data to the end of the remote file.<\/p>\n\n\n\n<p>The reason this option is limited to just subset of protocols is of course that they are the only ones for which we can give that instruction to the server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example<\/h2>\n\n\n\n<p>Append the local file &#8220;trailer&#8221; to the remote file called &#8220;begin&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl --append --upload trailer ftp:\/\/example.com\/path\/begin<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Previously mentioned command line options of the week. &#8211;append is the long form option, -a is the short. The option has existed since at least May 1998 (present in curl 4.8). I think it is safe to say that if we would&#8217;ve created this option just a few years later, we would not have &#8220;wasted&#8221; &hellip; <a href=\"https:\/\/daniel.haxx.se\/blog\/2020\/04\/13\/curl-ootw-append\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">curl ootw: &#8211;append<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":13041,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[33,486],"class_list":["post-13719","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-floss","tag-curl-and-libcurl","tag-option-of-the-week"],"_links":{"self":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/13719","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=13719"}],"version-history":[{"count":5,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/13719\/revisions"}],"predecessor-version":[{"id":13905,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/posts\/13719\/revisions\/13905"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media\/13041"}],"wp:attachment":[{"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/media?parent=13719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/categories?post=13719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.haxx.se\/blog\/wp-json\/wp\/v2\/tags?post=13719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}