The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
delete file older than N days ericaworld Shell Programming and Scripting 7 02-21-2008 05:34 AM
Delete user file(s) older then 'X' days ?? varungupta UNIX for Advanced & Expert Users 2 08-24-2007 02:01 AM
delete files and folders older than 3 days melanie_pfefer Shell Programming and Scripting 7 12-18-2006 09:58 AM
How can I delete files older than 7 days? odogbolu98 UNIX for Dummies Questions & Answers 3 02-26-2002 05:35 PM
delete files older than 7 days lesstjm UNIX for Dummies Questions & Answers 1 11-06-2001 07:43 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-08-2008
Registered User
 

Join Date: Feb 2008
Posts: 2
how to archive logs older than 5 days & then delete them?

My code is
tar -cvf logs.tar `find /usr/openv/logs/512*.log -mtime +2` && find *.log* -mtime +2 -exec rm {} \;

this gives me output as:
tar: Missing filenames
Reply With Quote
Forum Sponsor
  #2  
Old 02-08-2008
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,263
Quote:
Originally Posted by timus1980 View Post
My code is
tar -cvf logs.tar `find /usr/openv/logs/512*.log -mtime +2` && find *.log* -mtime +2 -exec rm {} \;

this gives me output as:
tar: Missing filenames
You seem to archive logs older than *2* days, not older than *5* days, as in the title, but that only as an aside.

I would state the command differently, if only for readability:

Code:
find /usr/openv/logs -name "512*.log" -type f -mtime +2 -print | tar -cvf logs.tar
find /usr/openv/logs -name "512*.log" -type f -mtime +2 -exec rm -f {} \;
I hope this helps.

bakunin
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:22 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0