Not sure this is the right stack where to ask this kind of question, however try with
tar -zxvf dagens_130325.tar.gz -C /tmp/130325 dagens
This way, the folder dagens
for the archive dagens_130325.tar.gz
is going to be extracted into /tmp/130325
. However, note that the target folder must exist, otherwise the command will fail
So, supposedly you have 4 archives in the form dagens_1.tar.gz
, dagens_2.tar.gz
, ...
, you can write an extract.sh
file containing
#!/bin/bash
for i in {1..4}
do
mkdir /tmp/$i
FILE="dagens_$i.tar.gz"
tar -zxvf $FILE -C /tmp/$i dagens
done
Having this file the execute
permission, being in the same folder as your archives and executing it should produced the result you asked.