{"id":159,"date":"2011-04-03T01:40:50","date_gmt":"2011-04-02T23:40:50","guid":{"rendered":"https:\/\/www.npcglib.org\/~stathis\/blog\/?p=159"},"modified":"2012-05-30T08:14:36","modified_gmt":"2012-05-30T06:14:36","slug":"transferring-files-reliably","status":"publish","type":"post","link":"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/","title":{"rendered":"Transferring files reliably"},"content":{"rendered":"<p>When moving many files across the wire, for example via ftp, sometimes files get corrupted or are transferred partially. Just because two files have the same size it does not mean that they have successfully been transferred. This problem can manifest itself when moving many thousands of files. I usually use either of two methods to verify that files have been transferred properly:<\/p>\n<p>(a) Use file checksums (e.g. using <a href=\"http:\/\/md5deep.sourceforge.net\/\">md5deep<\/a>, sha256deep).<br \/>\n(b) Use rsync&#8217;s checksum option.<\/p>\n<h3>Using file checksums<\/h3>\n<p>To create hashes for a tree of files use the <a href=\"http:\/\/md5deep.sourceforge.net\/\">md5deep<\/a> utility, or the included sha256deep, which computes a message digest for each file using the SHA-256 algorithm. The md5deep project is a collection of utilities using a variety of hashing algorithms to create a checksum for each file. That list of checksums can be then used on the receiving side of a transfer to verify the integrity of the transferred files.<\/p>\n<p>To create a list of file checksums, having relative paths on the transmitting side:<\/p>\n<pre>\r\ncd files_to_send\r\nsha256deep -rl * > hashes.sha\r\n<\/pre>\n<p>Now, copy the <code>hashes.sha<\/code> file to the receiving side, along with the files. To check against this file on the receiving side:<\/p>\n<pre>\r\ncd files_received\r\nsha256deep -rl -x hashes.sha * > files_did_not_match.txt\r\n<\/pre>\n<p>The <code>files_did_not_match.txt<\/code> file will contain any files that have problems. Resend them and verify them again.<\/p>\n<h3>Using rsync &#8211;checksum<\/h3>\n<p>You can also use rsync&#8217;s built-in checksum functionality to upload files while verifying their checksum:<\/p>\n<pre>\r\nrsync -av --checksum user@source.host.com:\/uploads\/files_to_send\/* \\\r\n                     user@destination.host.com:\/uploads\/files_received\/ \\\r\n                     > sync.log\r\n<\/pre>\n<p>This is a one-step operation with less hassle, but implies you have <a href=\"http:\/\/rsync.samba.org\/\">rsync<\/a>. There are many things you can do with rsync, so it is recommended to take a look into its various options if you transfer files, mirror, or sync between hosts often. On Windows, you can download <a href=\"http:\/\/www.itefix.no\/i2\/node\/10650\">cwrsync<\/a>, a packaging of <a href=\"http:\/\/www.cygwin.com\/\">cygwin<\/a> and rsync.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When moving many files across the wire, for example via ftp, sometimes files get corrupted or are transferred partially. Just because two files have the same size it does not mean that they have successfully been transferred. This problem can manifest itself when moving many thousands of files. I usually use either of two methods [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,7],"tags":[13],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"stathis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\",\"name\":\"sigmoid\",\"description\":\"..oo..oo..oo..oo..oo..oo..\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/#webpage\",\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/\",\"name\":\"Transferring files reliably - sigmoid\",\"isPartOf\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#website\"},\"datePublished\":\"2011-04-02T23:40:50+00:00\",\"dateModified\":\"2012-05-30T06:14:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Transferring files reliably\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41\",\"name\":\"stathis\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g\",\"caption\":\"stathis\"},\"url\":\"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/","twitter_misc":{"Written by":"stathis","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/","name":"sigmoid","description":"..oo..oo..oo..oo..oo..oo..","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.npcglib.org\/~stathis\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/#webpage","url":"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/","name":"Transferring files reliably - sigmoid","isPartOf":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#website"},"datePublished":"2011-04-02T23:40:50+00:00","dateModified":"2012-05-30T06:14:36+00:00","author":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41"},"breadcrumb":{"@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/2011\/04\/03\/transferring-files-reliably\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.npcglib.org\/~stathis\/blog\/"},{"@type":"ListItem","position":2,"name":"Transferring files reliably"}]},{"@type":"Person","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#\/schema\/person\/508363c4ebd1fd6066edf00c94e37e41","name":"stathis","image":{"@type":"ImageObject","@id":"https:\/\/www.npcglib.org\/~stathis\/blog\/#personlogo","inLanguage":"en-US","url":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/214f29f604ec7d8d2f1345c5fa617c09?s=96&d=mm&r=g","caption":"stathis"},"url":"https:\/\/www.npcglib.org\/~stathis\/blog\/author\/stathis\/"}]}},"_links":{"self":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/159"}],"collection":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":12,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":354,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/posts\/159\/revisions\/354"}],"wp:attachment":[{"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.npcglib.org\/~stathis\/blog\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}