This task can be split into two steps:
1. Unzip a tarball, and put it into a directory
mkdir -p myOut && tar -C myOut -xv mySource.tar
2. Unzip multiple tarball, and put it into its corresponding directory. For example, the files in group1.tar will be extracted to a directory group1.
# in the directory, say, myOut
for i in *.tar; do mkdir -p {i%.*};&& tar -C {i%.*} -xv $i; done
Please note that it works for a flat (not recursive).for i in *.tar; do mkdir -p {i%.*};&& tar -C {i%.*} -xv $i; done
No comments:
Post a Comment