On Mar 21, 11:47, Andreas Freiherr wrote:
Pete Turnbull wrote:
> The correct way to do someting like this in a cron entry is to check
the
> return code from the cd command, and only execute
the rest of the
command
if the cd
succeeds, eg
(cd /usr/preserve && find . -mtime +7 -a -exec rm -f {} \;)
Hm. I'm not a Unix guru, so it's well possible I'm missing something
here. Perhaps you can enlighten me.
Why don't you just
find /usr/preserve -mtime +7 -a -exec rm -f {} \;
In this case, that would do as well. I was just illustrating that you have
to be careful with unattended operations, and not do anything dangerous
unless you're sure you're in the right place (or other prerequisites have
been met).
--
Pete Peter Turnbull
Network Manager
University of York