sg86-
sg86-

Reputation: 75

Extracting split .tar files on linux, that separately need to be decrypted

i am trying to extract and decrypt 23 .tar files named as per below:

dev_flash_000.tar.aa.2010_07_29_170013

There are 23 of them, and each needs to be decrypted with an app called dePKG before it is extracted.

I tried this bash script:

for i in `ls dev_flash*`; do ./depkg $i $i.tar ; tar -xvf ./$i.tar ; rm $i.tar; done

and get this error for all 23 files:

read 0x800 bytes of pkg
pkg data @ 340 with size 3ec
not inflated, writing 1004 bytes
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

I just want to save time :D

Upvotes: 0

Views: 2354

Answers (1)

user562374
user562374

Reputation: 3917

You should not use ls in a ` ` context — see http://porkmail.org/era/unix/award.html#ls . FWIW:

for i in dev_flash*`; do
    ./depkg "$i" -;
done | tar -xv;

Check with your depkg manual pages on how to make it output to stdout, or if it does not, use /dev/stdout as a file. Not only does that save you the temporaries, but running a single tar command on the concatenation of the decrypted contents also works properly when the original archive has been split at arbitrary positions.

Upvotes: 0

Related Questions