Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create tar file from some .tar.gz file

Tags:

shell

tar

I would like to create a .tar file from all .gz files in $a/$b and delete those files afterwards.

I have come up with the following code but it's not working:

cd "$a"
#tar cf $a/$b'.tar' "$b_sql.gz" "$b_moh.tar.gz" 
tar cf $a/$b'.tar' $b'_*.gz'
gzip $a/$b'.tar'
rm -f $b'_*.gz'
like image 271
Samira Khorshidi Avatar asked Dec 16 '25 15:12

Samira Khorshidi


1 Answers

I try this way and answer :

cd "$a"
for f in $b'_*.gz'
do
   tar cf $a/$b'.tar' $f
done
like image 180
Samira Khorshidi Avatar answered Dec 19 '25 05:12

Samira Khorshidi