I'm trying to write a command to help clear up old cache asset files. The files are always either .css
,.javascript
,.css.gzip
or .javascript.gzip
and i want to delete all files older than 2 days old.
I started with this command to test before passing to exec rm
:
find /home/*/tmp/cache/* -mtime +2 -type f -name '*.css.gzip' -o -name '*.javascript.gzip' -o -name '*.javascript' -o -name '*.css'
This returns all the files i want deleting, so i've added rm
making the command:
find /home/*/tmp/cache/* -mtime +2 -type f -name '*.css.gzip' -o -name '*.javascript.gzip' -o -name '*.javascript' -o -name '*.css' -exec rm {} \;
Nothing is actually getting deleted though, i tried making the rm
command rm -i
and there were no prompts, as if nothing is actually being passed to rm.
Any ideas?
FWIW this is on a CentOS 5 box