Need help on Mulitple files mutliple actions

Hi all,

I have mistkanely gzipped twice an entire folder and sub folders, and also renamed the files during that process.

I am trying to undo this, and I need help to create the batch to work on it.

All folders are under my images directory, I have a output.txt file that holds all the names of the files, the process I need to do for each file is:

gunzip $i
rename the file from: XXX.pngzip to XXX.png.gz
gunzip $1 (2nd time)

This process works manually, but I aint gonna do it for 2500+ files (not even as a good learning lesson :-/

I am buffeled on my options, and can't really make my simple script work, I might not go the right direction, or just can't see the simple one.

I would like your advise.

Running the batch ofc will be run from the top folder, and all files will have to stay in the same place.

#!/bin/bash

for i in 'find -name *.pngzip.gz'
do
gunzip $i
#rename the file
gunzip $i
done

I don't mind using my output.txt file with all listed files as input, but I am trully lost.

thanks

OK,
I have done some more changes, and I have written a working code:

#!/bin/bash

for i in `cat dirs.txt`

do
# echo $i
pushd $i
gunzip *.pngzip.gz
rename .pngzip .png.gz *pngzip
gunzip *.png.gz
popd
done

It works on the list of ALL dirs so it's ok.

Thank you, if you have comments, ill be happy to learn more.