{"id":44,"date":"2010-03-04T10:54:19","date_gmt":"2010-03-04T09:54:19","guid":{"rendered":"http:\/\/blog.campodoro.org\/?p=44"},"modified":"2010-03-04T10:54:33","modified_gmt":"2010-03-04T09:54:33","slug":"linux-copy-folders-only","status":"publish","type":"post","link":"https:\/\/blog.campodoro.org\/?p=44","title":{"rendered":"Linux: copy folders only"},"content":{"rendered":"<p>I needed a simple script that would copy the entire folder structure of certain users (under Linux) to a backup destination. This is how I did it.<br \/>\nYou would need a file call users.txt with the names of the users, divided by linebreaks.<\/p>\n<p><strong>users.txt:<\/strong><br \/>\nuser1<br \/>\nuser2<br \/>\nuser3<\/p>\n<p>And this little script:<\/p>\n<p><strong>createfolders.sh:<\/strong><br \/>\n<code><br \/>\n#!\/bin\/sh<br \/>\ndest='\/backup'<br \/>\ncat users.txt | while read user;<br \/>\ndo<br \/>\n        base=\"\/users\/$user\"<br \/>\n        find $base -type d -print | cpio -pvdum $dest<br \/>\ndone<\/p>\n<p><\/code><\/p>\n<div class=\"tweetthis\" style=\"text-align:left;\"><p> <a class=\"tt\" href=\"http:\/\/twitter.com\/share?url=https:\/\/blog.campodoro.org\/?p=44&text=Linux%3A+copy+folders+only+%23campodoro+%23tips+%23apple&via=goudkamp&related=richardxthripp%2Ctweetthisplugin\" title=\"Twitter\"><img decoding=\"async\" class=\"nothumb\" src=\"http:\/\/blog.campodoro.org\/wp-content\/plugins\/tweet-this\/icons\/en\/twitter\/tt-twitter.png\" alt=\"Post to Twitter\" \/><\/a> <a class=\"tt\" href=\"http:\/\/twitter.com\/share?url=https:\/\/blog.campodoro.org\/?p=44&text=Linux%3A+copy+folders+only+%23campodoro+%23tips+%23apple&via=goudkamp&related=richardxthripp%2Ctweetthisplugin\" title=\"Twitter\">Tweet<\/a> <a class=\"tt\" href=\"http:\/\/delicious.com\/post?url=https:\/\/blog.campodoro.org\/?p=44&amp;title=Linux%3A+copy+folders+only\" title=\"Post to Delicious\"><img decoding=\"async\" class=\"nothumb\" src=\"http:\/\/blog.campodoro.org\/wp-content\/plugins\/tweet-this\/icons\/en\/delicious\/tt-delicious.png\" alt=\"Post to Delicious\" \/><\/a> <a class=\"tt\" href=\"http:\/\/delicious.com\/post?url=https:\/\/blog.campodoro.org\/?p=44&amp;title=Linux%3A+copy+folders+only\" title=\"Post to Delicious\">Post to Delicious<\/a> <a class=\"tt\" href=\"http:\/\/www.facebook.com\/share.php?u=https:\/\/blog.campodoro.org\/?p=44&amp;t=Linux%3A+copy+folders+only\" title=\"Post to Facebook\"><img decoding=\"async\" class=\"nothumb\" src=\"http:\/\/blog.campodoro.org\/wp-content\/plugins\/tweet-this\/icons\/en\/facebook\/tt-facebook.png\" alt=\"Post to Facebook\" \/><\/a> <a class=\"tt\" href=\"http:\/\/www.facebook.com\/share.php?u=https:\/\/blog.campodoro.org\/?p=44&amp;t=Linux%3A+copy+folders+only\" title=\"Post to Facebook\">Post to Facebook<\/a><\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>I needed a simple script that would copy the entire folder structure of certain users (under Linux) to a backup destination. This is how I did it. You would need a file call users.txt with the names of the users, &hellip; <a href=\"https:\/\/blog.campodoro.org\/?p=44\">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":[10,8],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-linux","category-menu"],"_links":{"self":[{"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=\/wp\/v2\/posts\/44"}],"collection":[{"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":0,"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.campodoro.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}