1

I am trying to uncompress all files in a directory. They are are scattered throughout various sub-directories, so I can't just use wildcards. Instead, I used find:

find . -name "*.tar.gz" -print0 -execdir tar xvf {} \;

That worked. However, I wanted to ignore files that were already uncompressed with --skip-old-files.

find . -name "*.tar.gz" -print0 -execdir tar xvf --skip-old-files {} \;

When I add --skip-old-files, I get an error for each file:

./path/to/file.tar.gztar: --skip-old-files: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

Why do I get an error? There must be some minor error that I am not seeing.

1 Answer 1

3

f expects its argument as the next command-line argument; with

tar xvf --skip-old-files {}

that’s --skip-old-files, which is thus interpreted as the file to be read, not as an option.

Use

tar xvf {} --skip-old-files

instead.

You must log in to answer this question.

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