LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-09-2010, 07:15 PM   #1
Siljrath
Bedrock Linux Advocate
 
Registered: Nov 2004
Location: the internet
Distribution: Devuan, while feeble. Bedrock, when awesome.
Posts: 188

Rep: Reputation: 61
tar files from multiple locations into a tarball preserving location paths


i reckon i could do this with a whole load of &&s and tar appends, but i'd much rather just paste in a list of file paths to a single command. ... i suppose i could achieve similar with a complex "mv" addition to the command, but then i'd lose the very important original locations.

attempts have either lead to multiple files (like when i tried just lzma alone) or error messages when tarring.



what i was trying on my mock-up test files:
Code:
g@usbgeneray:~$ lzma -zk9 /home/g/testzone/marglepeeps /home/g/testzone/om /home/g/testzone/mop.lzma
lzma: /home/g/testzone/mop.lzma: doesn't exist or is not a regular file
g@usbgeneray:~$ man tar
g@usbgeneray:~$ tar -c /home/g/testzone/marglepeeps /home/g/testzone/om /home/g/testzone/mop.tar
tar: Removing leading `/' from member names
tar: /home/g/testzone/mop.tar: Cannot stat: No such file or directory
home/g/testzone/marglepeeps0000644000175000017500000000004611415726164013603 0ustar  ggmarglemargle... pEEp! pEEp! pEEEEEEp!
home/g/testzone/om0000644000175000017500000000002611415726244011707 0ustar  ggommmmmmmmmmmmmmmmmmm

tar: Exiting with failure status due to previous errors
g@usbgeneray:~$ man tar
g@usbgeneray:~$ tar -c /home/g/testzone/mop
tar: Removing leading `/' from member names
tar: /home/g/testzone/mop: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
i've a feeling i'm going to be shown how silly i'm being and how simple an issue this is.

(and yeah, i did search for it for a while, but failed.)




so in my test example, i want to end up with the files "marglepeeps" and "om" in the same "mop.tar.lzma" file, even if i were to have one of marglepeeps or om, start from a distant location.

when i get this, i hope to include a list of config files into such a command, so i can transfer/backup these configs for use on other machines (and my archiso overlay folder) after a simple extraction.

Last edited by Siljrath; 07-09-2010 at 07:19 PM. Reason: added last two paragraphs about what i'm trying ot achieve.
 
Old 07-10-2010, 12:27 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
If you want to create a tar the name of the tar comes before
the directories you want to tar up ...
Code:
tar -cvzf /home/g/testzone/mop.tar.gz /home/g/testzone/marglepeeps /home/g/testzone/om

Cheers,
Tink
 
Old 07-10-2010, 01:23 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,507

Rep: Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890Reputation: 2890
Also, assuming you have the correct compression application installed, the following works well:
Code:
tar acf /home/g/testzone/mop.tar.XXX /home/g/testzone/marglepeeps /home/g/testzone/om
Replace XXX with any of the following - gz, bz2, lzma, xz, and so on
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Move some of the files from multiple directories to one location alex_chartier Linux - Newbie 4 06-21-2010 03:14 PM
help with tar not preserving owner z01krh Linux - Newbie 13 05-18-2009 01:19 PM
Gentoo Linux - how to map Apache server to look at php files in multiple locations bg108 Linux - Newbie 3 02-07-2008 04:51 AM
Using laptop in multiple locations with differnt IP Address at each location fieldyweb Linux - Networking 3 08-22-2005 12:16 PM
tarball installation location uvone Slackware 3 11-19-2004 03:23 AM


All times are GMT -5. The time now is 03:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration