Unpack tar.gz folder to part of filename -
i have file dagens_130325.tar.gz
containing folder dagens
. in 1 folder have hundreds of these daily info. unpack dagens_130325.tar.gz/dagens
130325
files inside. 130326
etc.
is there way it?
not sure right stack ask kind of question, try with
tar -zxvf dagens_130325.tar.gz -c /tmp/130325 dagens
this way, folder dagens
archive dagens_130325.tar.gz
going extracted /tmp/130325
. however, note target folder must exist, otherwise command fail
so, supposedly have 4 archives in form dagens_1.tar.gz
, dagens_2.tar.gz
, ...
, can write extract.sh
file containing
#!/bin/bash in {1..4} mkdir /tmp/$i file="dagens_$i.tar.gz" tar -zxvf $file -c /tmp/$i dagens done
having file execute
permission, being in same folder archives , executing should produced result asked.
Comments
Post a Comment