{"id":367,"date":"2007-04-26T10:57:31","date_gmt":"2007-04-26T16:57:31","guid":{"rendered":"http:\/\/blog.codedread.com\/archives\/2007\/04\/26\/using-tar-to-snapshot-a-subversion-working-directory\/"},"modified":"2007-04-26T10:57:31","modified_gmt":"2007-04-26T16:57:31","slug":"using-tar-to-snapshot-a-subversion-working-directory","status":"publish","type":"post","link":"https:\/\/www.codedread.com\/blog\/archives\/2007\/04\/26\/using-tar-to-snapshot-a-subversion-working-directory\/","title":{"rendered":"Using tar to Snapshot a Subversion Working Directory"},"content":{"rendered":"<p>I have a bunch of different <a href=\"http:\/\/subversion.tigris.org\/\">Subversion<\/a> repositories where I store documents.  Occasionally I'll place some unversioned files in these directories while working on something.  Today I needed to take a snapshot of the contents of my hard drive but I didn't want to keep all the hidden .svn directories.  Here's what worked for me.  <!--more--><\/p>\n<p>First, to clarify - what I wanted to do was take a snapshot of all files in my working directories (even the non-versioned ones).  In some cases, the SVN server was no longer around (for one reason or another) so this was really about taking the files on my hard drive and archiving them somewhere (but removing the .svn hidden files and directories).<\/p>\n<p>I use <a href=\"http:\/\/www.cygwin.com\/\">cygwin<\/a> on my Windows box because I love the power that Unix command line gives me.  Unfortunately, I hadn't installed the man package in cygwin, so I used Google to find a <a href=\"http:\/\/www.cse.msu.edu\/cgi-bin\/man2html?tar\">tar man page<\/a>.  It told me there is an exclude-file option (-X) so I did the following:<\/p>\n<div class=\"code\">\n$ find &#124; grep \\.svn$ &#124; cut -c3- > exclude.txt\n<\/div>\n<p>This creates a text file, called <i>exclude.txt<\/i> that has one line for every hidden .svn directory.  The reason I cut the first two characters out of the grep is because tar (for whatever reason) wouldn't exclude a directory named \".\/blah\/.svn\" but it would exclude a directory named \"blah\/.svn\".<\/p>\n<p>Once I had the exclude file, then I ran the tar command:<\/p>\n<div class=\"code\">\n$ tar cvfX archive.tar exclude.txt dir1\/* dir2\/* ...\n<\/div>\n<p>Hope it helps someone else...<\/p>\n<div class=\"ads\"><object type=\"text\/html\" width=\"468\" height=\"60\" data=\"http:\/\/www.codedread.com\/gads.php\"><\/object><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I have a bunch of different Subversion repositories where I store documents. Occasionally I&#8217;ll place some unversioned files in these directories while working on something. Today I needed to take a snapshot of the contents of my hard drive but I didn&#8217;t want to keep all the hidden .svn directories. Here&#8217;s what worked for me.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,25,11,14],"tags":[],"class_list":["post-367","post","type-post","status-publish","format-standard","hentry","category-linux","category-software","category-technology","category-tips"],"_links":{"self":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts\/367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/comments?post=367"}],"version-history":[{"count":0,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts\/367\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/media?parent=367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/categories?post=367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/tags?post=367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}