Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

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

% cat list.txt 
% for file in `cat list.txt`; do [ -f $file ] && echo $file; done | xargs tar rvf archive.tar
% 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
share|improve this answer
Thousands of files are gone. That's a great solution you presented. – gmuller Jul 5 '11 at 17:40
up vote 1 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.