LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-23-2005, 03:24 PM   #1
ldp
Member
 
Registered: Apr 2004
Location: Belgium Antwerpen
Distribution: slackware - knoppix
Posts: 141

Rep: Reputation: 18
tar: getting files from a file.


Hello,

I'm trying to create a tar archive. The input files are listed in one textfile.
How can I get tar to use this inputfile? Redirection like "tar -cvf t.tar < inputfile" doesn't work. I tried "tar -cvf t.tar `inputfile`" (tar -cvf t.tar `find directory -mtime -1 -f` did work fine)
I was looking through the man pages and found some option -T which made me think that it could do the job but can't figure out how to get it actually work.
I tried things like "tar -cvf t.tar -T inputfile" and "tar -cv -T inputfile -f t.tar" etc etc but none worked as I expected.

Can anyone point me in the right direction?
Did I completely misunderstand what the -T stands for?

thanks.
Lieven
 
Old 09-23-2005, 03:46 PM   #2
ldp
Member
 
Registered: Apr 2004
Location: Belgium Antwerpen
Distribution: slackware - knoppix
Posts: 141

Original Poster
Rep: Reputation: 18
my mistake...

The find commands that I used to populate the inputfile also included the directory names where the files were in. Therefore, tar also took the complete directory as input instead of only some files.

find /home -mtime -1 -type f

=>
/home
/home/lieven/f1
/home/lieven/f2

=> I only wanted the f1 and f2 ofcourse. I think I'll just need to use the -X modifier also to exclude these directories.

sorry for this.
 
Old 09-23-2005, 07:30 PM   #3
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
Try:
Code:
tar cvf mytarfile.tar `cat inputfile`
Those are backticks around cat (etc), not apostropes.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 12:02 PM
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 10 02-23-2008 06:40 AM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 04:15 AM
list files in a tar.gz file linuxtesting2 Linux - Newbie 4 09-23-2004 03:49 AM
what file association to use for tar gz files dogface Fedora - Installation 5 08-09-2004 04:04 PM


All times are GMT -5. The time now is 04:00 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration