I can successfully run this command in the terminal:
find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm {} \
However when I add it as a cron job like so:
*/5 * * * * find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm {} \
It doesn't work and the system sends a mail saying find: missing argument to '-exec'
What can I do to make it work as a cron task?
/usr/bin/find
in the cron – George Udosen Jan 14 '18 at 01:01\\`` but no actual character (AFAIK it should be
;- or optionally
+if your version of
find` supports it) – steeldriver Jan 14 '18 at 01:02/usr/bin/find
now. – Dan P. Jan 14 '18 at 01:03usr/bin/find
but I still getusr/bin/find: missing argument to -exec
– Dan P. Jan 14 '18 at 01:15-name '*'
accomplishes? Also, some versions of find support-delete
. – dhag Jan 14 '18 at 01:24-name '*'
to delete any file that's older than 180 days. Is it even needed? – Dan P. Jan 14 '18 at 01:32-name '*'
is not needed – fpmurphy Jan 14 '18 at 01:47