Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating tar from file listing

Status
Not open for further replies.

mosstw

Technical User
Mar 28, 2003
4
US
I'm trying to creat a tar file from a .txt listing of files with full path/filename info.
Can't seem to to get correct syntax.
Any help would be appreciated.
Thanks. MOSSTW
 
Hi,

Can you show me what tar command did you use?

Example you can use:

tar -cvf demo.tar --files-from=demo.txt

Within demo.txt contain all the file you want to tar, full path. Make sure you have permission on the file/fodler as well.

regards,
feroz
 
If you are trying to create a tar file from a listing of files, the command is - tar cvfF <file> file.f - where the <file> is the destination file and the file.f is the text file containing the names of the files with full paths.
 
Thanks dbase77 and timsr...
I'm trying the suggestions now.
The syntax I was trying to work from is as follows which came from another web discussion but the tar line appears to only want to write to tape. I could not figure a method to write to filename.tar

find / -mtime -1 \! -type d -print > /backup/daily
tar -cv -T /backup/daily -f /dev/rft0

Thanks again for the help.
 
I guess I'm not having any success. Is it possible I'm working from a different tar util (I'm on Solaris 5.8)
Here's the responses I'm getting...

(I get the following error)
$tar -cvf demo.tar --files-from=demo.txt
tar: --files-from=demo.txt: No such file or directory

(In the following example, it actually tars the .txt file but not the individul files listed inside.)
$tar -cvfF demo.tar demo.txt
a demo.txt 1K
 
If you have a list of files that you want created as a tar do the following:

ls > list
than type this command: tar -cvf nameoffile.tar -T list
 
Hi,

Im on solaris 8 as well. Here is the correct command.

tar -cvf demo.tar -I file.lst

Within the file.lst contain all the file/directory you want to insert.

Let us know how you getting on.

regards,
feroz
 
Hi

Try this:

tar cvf archivename `cat filename.txt`

Cheers
 
Awesome!
The following syntax did the trick!
$tar -cvf demo2.tar -I demo.txt
a ./Unity/POSGetInfo/build/Makefile.solaris 6K
a ./Unity/POSGetInfo/idl/atPOSGetInfo.idl 8K

Not sure if Solaris has some unique properties cause so many attempts didn't fly. The -I vs -T was an issue. This is going to help considerably with day-to-day deployments.
Thanks Feroz -
TMoss

BTW- I tried the follow suggestion, here's the results.
$tar -cvf demo2.tar 'cat demo.txt'
tar: cat demo.txt: No such file or directory
Thanks HeavyDman & everyone else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top