homepage Welcome to WebmasterWorld Guest from 54.166.116.36
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
cron: find and remove without return error
webstyler

10+ Year Member



 
Msg#: 3160993 posted 5:30 pm on Nov 18, 2006 (gmt 0)

Hello

I have setting a cron that lunch this code any 60 minutes:

find /home/myhone/public_html/files -cmin +60 -exec rm -rf {} \;

all perfect.. but I received message:

find: /home/myhome/public_html/files: No such file or directory

when cron don't find anything..

is possible to not receive this message?

tx

 

mcavic

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3160993 posted 10:44 pm on Nov 18, 2006 (gmt 0)

To ignore the errors, just put:
> /dev/null 2>&1
at the end of the command.

But, that command is removing the files directory itself, which I don't think you want. Using this intead, you shouldn't have any errors:

find /home/myhome/public_html/files/* -depth -cmin +60 -exec rm -rf {} \;

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved