{"id":152,"date":"2016-07-26T06:03:00","date_gmt":"2016-07-26T10:03:00","guid":{"rendered":"http:\/\/www.dev-notes.com\/blog\/2016\/07\/26\/backing-up-android-phone-to-linux\/"},"modified":"2016-07-26T06:03:00","modified_gmt":"2016-07-26T10:03:00","slug":"backing-up-android-phone-to-linux","status":"publish","type":"post","link":"https:\/\/www.dev-notes.com\/blog\/2016\/07\/26\/backing-up-android-phone-to-linux\/","title":{"rendered":"Backing up Android Phone to Linux"},"content":{"rendered":"<p>My environment: Smart phone running Android version 6.0.1, and computer running Ubuntu 16.04 LTS<\/p>\n<p>I have a few key folders on my phone that I would like to back up regularly.  For simplicity sake, let us say that I am just dealing with the &#8220;Camera&#8221; folder which holds all my latest photographs.  The following commands makes use of gvfs-commands (Gnome virtual file system) to copy\/move files, assuming the phone has been connected via USB to the computer, and the phone has been unlocked.<\/p>\n<p>The bash script I currently run looks like this:<\/p>\n<pre class=\"code\">\n#!\/bin\/bash\n\nfor D in \/run\/user\/1000\/gvfs\/*\ndo\n\tgvfs-copy ${D}\/Phone\/DCIM\/Camera\/*.* \/picfolder\/ \n\tgvfs-move ${D}\/Phone\/DCIM\/Camera\/*.* \/tmpfolder\/\n\tgvfs-move \/tmpfolder\/*.* ${D}\/Phone\/Pictures\/1-ToSort\/ \n\n\techo \"${D} done\" \ndone\n<\/pre>\n<p>As you may have noticed, I took the safe approach of copying the photos to my computer, then moving the same photos again to a temporary directory on my computer, and finally moving the temporary files back onto the phone in an archive folder.  The final steps effectively represents a move from the Camera folder on the phone to the archive folder on the phone; this is because gvfs-move does not support the move of files within the same device at this time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This note demonstrates a simple way to back up files from Android to Linux.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,28],"tags":[],"class_list":["post-152","post","type-post","status-publish","format-standard","hentry","category-android","category-linux"],"_links":{"self":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/comments?post=152"}],"version-history":[{"count":0,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/152\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/media?parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/categories?post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/tags?post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}