In all sub-directories gzip all *.html and *.php files

Hi,

in all sub-directories gzip all *.html and *.php files

How do i do that in linux
LVL 10
gg234Asked:
Who is Participating?
 
xDamoxCommented:
Hi,

You could do the following:

find /var/www -name *.htm -exec gzip -9 {} \; && find /var/www -name *.php -exec gzip -9 {} \;  

Replace /var/www path with tha path of where you want to start.
0
 
gg234Author Commented:
i want to gzip the files menctioned files in all subdirectories
0
 
ravenplCommented:
The above does, and just little fix/improvement to have just one call
find /var/www -type f -name '*.html' -o -name '*.php' -exec gzip -9 {}\;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.