{"id":2957,"date":"2014-08-15T12:26:07","date_gmt":"2014-08-15T17:26:07","guid":{"rendered":"http:\/\/www.summet.com\/blog\/?p=2957"},"modified":"2014-08-15T05:28:28","modified_gmt":"2014-08-15T10:28:28","slug":"using-rsync-to-selectively-restore-a-backup","status":"publish","type":"post","link":"https:\/\/www.summet.com\/blog\/2014\/08\/15\/using-rsync-to-selectively-restore-a-backup\/","title":{"rendered":"Using rsync to selectively restore a backup (with\/without dotfiles)"},"content":{"rendered":"<p>If you have backed up your entire home directory, and are restoring it onto a new computer, sometimes you do not want to copy over all of the .dotfiles (hidden files and directories that start with a period) in your home directory. This can be especially useful if you are upgrading the operating system version and many applications are also upgraded, and you want to re-configure them manually. <\/p>\n<p>To restore everything BUT the .dotfiles in the main root directory you can use the following rsync command (the command must be executed from inside the backed up home directory):<\/p>\n<p><code>rsync -av - --exclude=\"\/.*\" .\/ \/home\/NewHomeDir<\/code><\/p>\n<p>Note that this WILL copy all .dotfiles in directories under the main home directory.<\/p>\n<p>I do recommend keeping all of your old home directory dotfiles in a separate &#8220;dotfile&#8221; directory, because invariably you will need something from in them (such as an SSH private key, GPG key, etc&#8230;)<\/p>\n<p>You can copy JUST the .dotfiles from the home directory (including recursing into .dotdirectories) with the following command:<\/p>\n<p><code>rsync -av \/path\/to\/sourcedir\/.??* \/path\/to\/dest<\/code><\/p>\n<p>The .??* selects only files\/directories in the sourcedir that start with a dot. Note that .* alone would select ALL files and directories in the sourcedir.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have backed up your entire home directory, and are restoring it onto a new computer, sometimes you do not want to copy over all of the .dotfiles (hidden files and directories that start with a period) in your &hellip; <a href=\"https:\/\/www.summet.com\/blog\/2014\/08\/15\/using-rsync-to-selectively-restore-a-backup\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-2957","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/2957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/comments?post=2957"}],"version-history":[{"count":0,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/posts\/2957\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/media?parent=2957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/categories?post=2957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.summet.com\/blog\/wp-json\/wp\/v2\/tags?post=2957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}