I want to gzip all of my CSS files recursively. But my command is not working properly.
I'm using find
with the -exec
option
$ find . -name "*.css" -exec gzip -c "{}" > "{}.gz" \;
When using -exec echo
(or just leave the -exec
part) it's clearly finding my plugin[1,2].min.css
together with index.css
but when using -exec gzip
it's just ignoring any files, unless index.css
.
The file size of index.css.gz
is the same as when running gzip manually for index.css
.
I've no idea whats going on. Any ideas?
$ tree
.
├── css
│ ├── custom
│ │ └── index.css
│ └── vendor
│ ├── plugin1
│ │ └── plugin1.min.css
│ └── plugin2
│ └── plugin2.min.css
# ...
$ find . -name "*.css" -exec gzip -c "{}" > "{}.gz" \;
$ tree
.
├── css
│ ├── custom
│ │ ├── index.css
│ │ └── index.css.gz
│ └── vendor
│ ├── plugin1
│ │ └── plugin1.min.css
│ └── plugin2
│ └── plugin2.min.css