Date: Sun, 7 Apr 2013 20:07:17 -0400 (EDT) From: vogelke+unix@pobox.com (Karl Vogel) To: questions@freebsd.org Subject: Re: using pax command for archive & restore Message-ID: <20130408000718.2875ABF92@kev.msw.wpafb.af.mil> In-Reply-To: <515E23E2.1090906@a1poweruser.com> (message from Joe on Thu, 04 Apr 2013 21:07:46 -0400) References: <515E23E2.1090906@a1poweruser.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>> On Thu, 04 Apr 2013 21:07:46 -0400, >> Joe <fbsd8@a1poweruser.com> said: J> I archive using the pax command like this J> pax -wzXt -x cpio -f ${archive_path_file} ${ip_path_file} ${ip_path_dir} J> and restore J> pax -rz -pe -f ${archive_path_file} J> and it restores the contents back to the same location it came from J> which is what I want. Now I would like to restore that archive file to J> a different directory. This has to be simple, but I can't see the trees J> because the forest is in the way. What am I missing here? I use pax all the time, and it's much easier to do what you want if you use it from a relative directory as part of a pipeline. When creating the archive: you% cd /some/place you% find . -depth -print | /prog/to/remove-crap | pax -wd -x cpio | gzip -c > /tmp/x.pax.gz When reading it: you% cd /other/place you% gunzip -c < /tmp/x.pax.gz | pax -r -pe Why do the compression outside of pax? Because now you have a choice of gzip -1c (fast compression), bzip2 (better compression), xz (*way* better compression), etc. If you have a ton of files to move, you can break up the list: you% cd /some/place you% mkdir /tmp/work /tmp/copy you% find . -depth -print | /prog/to/remove-crap | split - /tmp/work/x you% for file in /tmp/work/x*; do > b=`basename $file` > pax -wd -x cpio < $file | gzip -c > /tmp/copy/$b.pax.gz > scp /tmp/copy/$b.pax.gz wherever # and remove it > rm $file > done -- Karl Vogel I don't speak for the USAF or my company Why no one ever uses the Restroom on "Star Trek" #7: Special effects dept. draws a blank on Hi-tech toilets.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130408000718.2875ABF92>