{"id":1800,"date":"2014-12-05T17:46:09","date_gmt":"2014-12-05T22:46:09","guid":{"rendered":"http:\/\/nazitunnels.org\/?p=1800"},"modified":"2014-12-09T10:34:34","modified_gmt":"2014-12-09T15:34:34","slug":"copying-files-from-mac-to-linux-with-umlauts","status":"publish","type":"post","link":"http:\/\/nazitunnels.org\/2014\/12\/05\/copying-files-from-mac-to-linux-with-umlauts\/","title":{"rendered":"Copying Files From Mac to Linux With Umlauts"},"content":{"rendered":"<p>I ran into an issue today where I wanted to copy some files from my laptop to the web server.<\/p>\n<p>Usually, I just run the scp\u00a0command like so:<\/p>\n<p><span class=\"lang:sh decode:true crayon-inline\">scp -r \/path\/to\/files\/on\/laptop\/ user@server.com:\/path\/to\/put\/files\/<\/span><\/p>\n<p>This will copy all of the files without problems.<\/p>\n<p>The problem is that there were nearly 300 files to copy, and so I left the laptop to do the copy. In the meantime, it went to sleep, stopping the copy. Scp is not smart enough to just copy the files that didn&#8217;t get copied, but will copy all nearly 300 files again.<\/p>\n<p>There is a program that has this intelligence, though&#8230; <span class=\"lang:default decode:true  crayon-inline \">rsync<\/span>\u00a0!<\/p>\n<p>Run this command like so:<\/p>\n<pre class=\"lang:sh decode:true\">rsync -avz \/path\/to\/files\/on\/laptop\/ -e ssh user@server.com:\/path\/to\/put\/files\/\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: 17px; line-height: 1.55;\">This usually works great&#8230; except when there are umlauts in the file names. Apparently Macs and Linux use a different terminology when talking UTF-8.<\/span><\/p>\n<p>The default Mac version of rsync is woefully out of date, though, and doesn&#8217;t support an option to fix this issue.<\/p>\n<h3>The solution!<\/h3>\n<p>You&#8217;ll need to have homebrew installed in order to update to the latest version of rsync. If you don&#8217;t have <a title=\"Homebrew\" href=\"http:\/\/brew.sh\/\">homebrew<\/a> installed already, you need to.<\/p>\n<p>Then it&#8217;s a simple install command:<\/p>\n<pre class=\"lang:sh decode:true \">brew install rsync\r\n\r\n<\/pre>\n<p>And now you can do the rsync command again:<\/p>\n<pre class=\"lang:sh decode:true \">rsync -avz\u00a0--iconv=UTF8-MAC,UTF-8\u00a0\/path\/to\/files\/on\/laptop\/ -e ssh user@server.com:\/path\/to\/put\/files\/<\/pre>\n<p>&nbsp;<\/p>\n<p>The &#8211;inconv option allows Mac and Linux to speak the same UTF-8 language.<\/p>\n<p>Special thanks to <a href=\"http:\/\/janaksingh.com\/blog\/rsync-osx-foreign-letters-filenames-delete-copy-loop-153\">Janak Singh<\/a> for the rsync option and detailed information on the issue.<\/p>\n<p>&nbsp;<\/p>\n<p>Update: December 9, 2014.<\/p>\n<p>There were some issues with the umlauts on the Linux server, and with the names of the files as I put them into Omeka, so I decided to do away with the special characters altogether. But how to change all of the file names? Easy, use the rename command.<\/p>\n<p>On the Linux server it was easy as:<\/p>\n<pre class=\"lang:default decode:true \">rename \u00fc ue *.png<\/pre>\n<p>on the Mac I needed to install the rename command with homebrew first:<\/p>\n<pre class=\"lang:default decode:true \" >brew install rename<\/pre>\n<p>The syntax is a little bit different on the Mac:<\/p>\n<pre class=\"lang:default decode:true \">rename -s \u00fc ue *.png<\/pre>\n<p>&nbsp;<\/p>\n<p>You can also do a dry run to make sure it the command doesn&#8217;t do something you don&#8217;t like.<\/p>\n<pre class=\"lang:default decode:true \">rename -n -s \u00fc ue *.png<\/pre>\n<p>&nbsp;<\/p>\n<p>That takes care of the special characters issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ran into an issue today where I wanted to copy some files from my laptop to the web server. Usually, I just run the scp\u00a0command like so: scp -r \/path\/to\/files\/on\/laptop\/ user@server.com:\/path\/to\/put\/files\/ This will copy all of the files without problems. The problem is that there were nearly 300 files to copy, and so I &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[32,86],"tags":[89,36,87,90,88,91],"class_list":["post-1800","post","type-post","status-publish","format-standard","hentry","category-methodology","category-technology","tag-homebrew","tag-images","tag-rsync","tag-scp","tag-ssh","tag-umlauts"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/posts\/1800"}],"collection":[{"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/comments?post=1800"}],"version-history":[{"count":5,"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/posts\/1800\/revisions"}],"predecessor-version":[{"id":1806,"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/posts\/1800\/revisions\/1806"}],"wp:attachment":[{"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/media?parent=1800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/categories?post=1800"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nazitunnels.org\/wp-json\/wp\/v2\/tags?post=1800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}