Re: [CentOS] Find files

2008-02-22 Thread Steve Searle
Around 02:42am on Saturday, February 23, 2008 (UK time), Matt Shields scrawled:

> You can also do it like this
> 
> /usr/bin/find /mnt/iog -type f -name '*.tar.gz' -mtime +7 -print -exec
> rm -f {} \;

man tmpwatch

Steve

-- 

A:  Because it messes up the order in which people normally read text.
Q:  Why is top-posting a bad thing?

 03:28:02 up 7 days, 18:31,  1 user,  load average: 0.11, 0.05, 0.03


pgpri5oIA79nN.pgp
Description: PGP signature
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Find files

2008-02-22 Thread Matt Shields
On Fri, Feb 22, 2008 at 9:16 PM, Robert <[EMAIL PROTECTED]> wrote:
>
>
>  [EMAIL PROTECTED] wrote:
>  > Hi,
>  >
>  > I am trying to delete files that are more than 7 days old. When I
>  > run it interactively it works, no problem, but it does not run
>  > from a file stored in cron.daily. The rest of that daily file
>  > runs properly. [The execute bit is on].
>  >
>  > I don't see anything in the /var/log/messages.
>  >
>  > ---
>  > #!/bin/bash
>  >
>  > find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xarg rm
>  > ---
>  >
>  > Any idea what am I missing?
>  >
>  Just a shot in the dark:  Cron is kinda partial to absolute paths.
>  Change your 1-liner to:
>
>  /usr/bin/find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xargs rm
>
>  That, and the "xargs" that Garrick pointed out.
>
>
>  Good luck.
>  ___
>  CentOS mailing list
>  CentOS@centos.org
>  http://lists.centos.org/mailman/listinfo/centos
>

You can also do it like this

/usr/bin/find /mnt/iog -type f -name '*.tar.gz' -mtime +7 -print -exec
rm -f {} \;


If you want to log the results that were deleted try this

/usr/bin/find /mnt/iog -type f -name '*.tar.gz' -mtime +7 -print -exec
rm -f {} \; >> mylog 2> /dev/null


-- 
-matt
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Find files

2008-02-22 Thread Robert



[EMAIL PROTECTED] wrote:
Hi, 


I am trying to delete files that are more than 7 days old. When I
run it interactively it works, no problem, but it does not run
from a file stored in cron.daily. The rest of that daily file
runs properly. [The execute bit is on].

I don't see anything in the /var/log/messages.

---
#!/bin/bash

find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xarg rm
---

Any idea what am I missing?
  
Just a shot in the dark:  Cron is kinda partial to absolute paths. 
Change your 1-liner to:


/usr/bin/find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xargs rm

That, and the "xargs" that Garrick pointed out.


Good luck.
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] Find files

2008-02-22 Thread Garrick Staples
On Fri, Feb 22, 2008 at 01:40:11PM -0800, [EMAIL PROTECTED] alleged:
> Hi, 
> 
> I am trying to delete files that are more than 7 days old. When I
> run it interactively it works, no problem, but it does not run
> from a file stored in cron.daily. The rest of that daily file
> runs properly. [The execute bit is on].
> 
> I don't see anything in the /var/log/messages.
> 
> ---
> #!/bin/bash
> 
> find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xarg rm
> ---
> 
> Any idea what am I missing?

'xargs' instead of 'xarg'?

Is there an error message?  "it does not run" is rather vague.

-- 
Garrick Staples, GNU/Linux HPCC SysAdmin
University of Southern California

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


pgpFcrab2Scq1.pgp
Description: PGP signature
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


[CentOS] Find files

2008-02-22 Thread centos
Hi, 

I am trying to delete files that are more than 7 days old. When I
run it interactively it works, no problem, but it does not run
from a file stored in cron.daily. The rest of that daily file
runs properly. [The execute bit is on].

I don't see anything in the /var/log/messages.

---
#!/bin/bash

find /mnt/iog -type f -name '*.tar.gz' -mtime +7 | xarg rm
---

Any idea what am I missing?

-- 
Thanks
http://www.911networks.com
When the network has to work
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos