If you really want to do so, you could simply use a for
construct which exists in almost every shell (even on cmd.exe !). In Bourne or Posix sh
flavour, it gives
for file in *.js *.css ; do gzip "$file" ; mv "$file.gz" "$file"; done
In Windows cmd.exe it should write (provided you've got a gzip command in your path):
for %file in (*.js *.css) do gzip %file && move %file.gz %file
But BEWARE : as others warned you, you will have binary gzipped files named foo.js
or fee.css
. If you serve them to standard browsers it definitely will not work !
Be sure to make a backup copy before trying that - it can easily be reversed, but you could at least lose time ...
EDIT : added quotes to shell command as suggested by gniourf_gniourf