Thursday, 19 June 2008

Untar with wild cards

The tar application doesn't like using wild cards. If you are trying to decompress multiple files in one go you might try a command like:
user@computer:~/archives> tar -xf *.tar
However, this produces multiple errors, one for each file that the wild card matches:
tar: archive1.tar: Not found in archive
tar: archive2.tar: Not found in archive
tar: archive3.tar: Not found in archive
tar: archive4.tar: Not found in archive
tar: archive5.tar: Not found in archive
A quick solution is to use a loop to decompress them one at a time like so:
user@computer:~/archives> for archive in *.tar ; do tar -xf archive ; done

No comments:

Post a Comment