Re: hundred files to tar and untar
On Mon, Nov 10, 2008 at 08:10:36AM -0500, chloe K wrote: Hi I have hundred files to tar How can I make tar the file but untar in different folder? eg: tar cvf html.tar /var/web/data/verion/cc.html untar html.tar /var/web/data/root/cc.html Thank you RTFM. Specifically look at the -C option. Or you could do it the simple way (note parenthesis, the cd only applies within the parenthesis, when the command clompletes your shell is back to the original directory): (cd /var/web/data/verion/cc.html ; tar -cvf somewhere/html.tar * ) (cd /var/web/data/root/cc.html ; tar -xvf somewhere/html.tar ) The above does not store the path prefix in the tar archive, which is perhaps the problem you were trying to solve? -- David Kelly N4HHE, [EMAIL PROTECTED] Whom computers would destroy, they must first drive mad. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: hundred files to tar and untar
On Mon, Nov 10, 2008 at 08:10:36AM -0500, chloe K wrote: Hi I have hundred files to tar How can I make tar the file but untar in different folder? Just use cd. You can use cd in a script just like you would at the command line. cd /what/ever/the/source/directory/is tar cvf ../htmlstuff.tar /cc.html mkdir -p /where/ever/you/want/it cd /where/ever/you/want/it tar xvf /what/ever/the/source/directory/htmlstuff.tar This would eliminate the directory tree being recreated where you unroll the tar presuming that fantasy path I first cd to is, in your example, /var/web/data/verion If you want to preserve that directory path in the new place you do cd / tar cvf /htmlstuff.tar /what/ever/the/source/directory/is/cc.html mkdir -p /where/ever/you/want/it cd /where/ever/you/want/it tar xvf /htmlstuff.tar You can put that in a loop in your script if it can pick up the file names and directory paths to plug in the commands. eg: tar cvf html.tar /var/web/data/verion/cc.html untar html.tar /var/web/data/root/cc.html Thank you - Yahoo! Canada Toolbar : Search from anywhere on the web and bookmark your favourite sites. Download it now! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: hundred files to tar and untar
Thank you but I have hundred files in different folders and it may need 3 files in 100 files in this folder. I did put need files in file.txt and using tar zcvf file.tar.gz -T file.txt inside file.txt eg: /var/web/data/version/cc.html but don't know how to restore as restore directory is in different folder /var/web/data/cc.html thank you David Kelly [EMAIL PROTECTED] wrote: On Mon, Nov 10, 2008 at 08:10:36AM -0500, chloe K wrote: Hi I have hundred files to tar How can I make tar the file but untar in different folder? eg: tar cvf html.tar /var/web/data/verion/cc.html untar html.tar /var/web/data/root/cc.html Thank you RTFM. Specifically look at the -C option. Or you could do it the simple way (note parenthesis, the cd only applies within the parenthesis, when the command clompletes your shell is back to the original directory): (cd /var/web/data/verion/cc.html ; tar -cvf /html.tar * ) (cd /var/web/data/root/cc.html ; tar -xvf /html.tar ) The above does not store the path prefix in the tar archive, which is perhaps the problem you were trying to solve? -- David Kelly N4HHE, [EMAIL PROTECTED] Whom computers would destroy, they must first drive mad. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] - Yahoo! Canada Toolbar : Search from anywhere on the web and bookmark your favourite sites. Download it now! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]