![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Quote:
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 {} \;
bakunin |
|||
| Google The UNIX and Linux Forums |