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 Chris Miller 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 list, incorect tar ?

Status
Not open for further replies.

Lim

Programmer
Aug 15, 2000
192
US
HP-UX 11.
I have list of files I want to tar, they all in one directory, so I do next :
cat archives/9/9.filelist_exec_NT40_INTEL.win32|xargs tar cvf mytar.tarit
it prints:
a projbin/NT40_INTEL.win32/file1 5 blocks
a projbin/NT40_INTEL.win32/file2 258 blocks
....
all files frommy list.

The whole tar file should be about 208Mb, but in result it is only 23Mb and includes only las few files. I monitor size of tar files, so it is growing about upto 190Mb, then jump back to zero and starts grow again.
This is netapp directory and my exe files has been created on Nt. Strange but I don't have this problem with another similar directory, other directories even biger about 240Mb. Also when I tar whole directory like:
tar cfv my_tar.tar my_dir/*
it works fine.
I have enoughf space 9 G in this direcory and in /tmp about 888Mb free.
This problem is reproduceble and each next run it leavs one more less file in tar archive, what can it be? Any system setings?
This is the wierdes thing I sow on UNIX.
 
Can you just use tar alone without cat?

#tar cvf test.tar /archives/9/9.filelist_exec_NT40_INTEL.win32/*

Patel
 
The problem - I don't need all files from this directory, I am making back up, so I need only files which changed and that why I am creating this list before archiving.
 
Start your tar file by putting the list file in it first:

/usr/bin/tar -cvnf SOMETHING.tar ./list.txt

Then put this into a for loop, it's a bit slow, but it works:

# This uses ksh93

for FILE in `/usr/bin/cat ./list.txt`
do
(cd ${FILE%/*};/usr/bin/tar -rvnf SOMETHING.tar ${FILE##*/})
done

This should be what your looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top