The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to remove all empty files within the directory structure? cat123 Shell Programming and Scripting 5 06-05-2008 06:01 AM
shell script to remove old files and write to a log file yabai Shell Programming and Scripting 3 05-21-2008 12:52 AM
Remove help removing to files wereyou UNIX for Dummies Questions & Answers 3 12-27-2007 03:44 PM
Remove the older files Prasandha UNIX for Dummies Questions & Answers 1 10-17-2006 12:03 AM
remove files Nisha Shell Programming and Scripting 7 06-25-2002 09:04 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-01-2006
Registered User
 

Join Date: Jan 2006
Posts: 6
Script to remove log files

Can anyone help me with a shell script to remove all files (log files) created 7 days before current system date.

TIA,
Kiran.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-01-2006
Registered User
 

Join Date: Jan 2006
Posts: 6
Sorry a bit of google helped me to write the following.

#!/bin/bash
/usr/bin/find / -name *.log -ctime +7 -exec /bin/rm -f {} \;
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:50 PM.


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

Content Relevant URLs by vBSEO 3.2.0