0

I have a gigantic list of files on a text files. This list is passed to tar, like this:

cat list.txt | xargs tar rvf archive.tar --ignore-failed-read

The problem is that some files that are on the list don't exist anymore. So tar keeps saying "Cannot stat: No such file or directory...". I have no problems with that, however when some of these messages appear, tar hungs, and wait some minutes to resume the actions, making the backup very slow. Any ideas on how I can filter only the existing files to tar?

Regards

2 Answers 2

5

How big is the list and how many files are gone? Can you filter the missing files?

% cat list.txt 
foo/bar
foo/baz
foo/fred
foo/wilma
betty
% for file in `cat list.txt`; do [ -f $file ] && echo $file; done | xargs tar rvf archive.tar
foo/bar
foo/fred
betty
% tar tvf archive.tar 
-rw-r--r-- scott/scott       0 2011-07-05 10:25 foo/bar
-rw-r--r-- scott/scott       0 2011-07-05 10:25 foo/fred
-rw-r--r-- scott/scott       0 2011-07-05 10:25 betty
% 
1
  • Thousands of files are gone. That's a great solution you presented.
    – gmuller
    Commented Jul 5, 2011 at 17:40
1

I don't know if it's the best way, but I've found out that using the parameter -T, tar will be much happier. tar rvf archive.tar --ignore-failed-read -T filelist.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .