The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
deleting files with dates 3 months ago godalle UNIX for Dummies Questions & Answers 3 11-08-2005 03:03 AM
Last modification times of files less than 6 months old Abhishek Ghose UNIX for Dummies Questions & Answers 1 10-19-2005 07:37 AM
Find files older than 5 days and remove tem after listing ypatel6871 UNIX for Dummies Questions & Answers 1 09-05-2005 11:00 AM
find, remove, and ftp...... peter.herlihy UNIX for Dummies Questions & Answers 1 06-25-2002 06:51 AM
Listing files older than 2 months pbekal Shell Programming and Scripting 3 01-17-2002 02:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2008
cvdev cvdev is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
Find 3 months old log files and remove

HI

I HAVE LOG FILES IN THIS FORMAT

XXX.log.20080509215745
XXX.log.20080209205745
XXX.log.20080301785745
XXX.log.20080109155745
XXX.log.20080409115745
XXX.log.20080309105745

I NEED TO FIND THE FILES FROM 3 MONTHS OLD AND REMOVE

PLEASE HELP

THANKS,
  #2 (permalink)  
Old 05-22-2008
incredible incredible is offline Forum Advisor  
Registered User
  
 

Join Date: May 2008
Location: s'pore
Posts: 2,061
find /yourdir -type f -name "filename.*" -mtime +90 -exec rm {} \;
  #3 (permalink)  
Old 05-22-2008
Tirmazi's Avatar
Tirmazi Tirmazi is offline
Registered User
  
 

Join Date: Apr 2008
Location: Maryland, USA
Posts: 50
#find . -name *.log* -mtime +90 -exec rm {} \;
but before that get a listing to see what you are about to delete
#find . -name *.log.* -mtime +90 -exec ls -tl {} \;
Search and remove is a potentially dangerous command make sure you are in the directory where you are deleting files find . means present directory
  #4 (permalink)  
Old 05-22-2008
cvdev cvdev is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
Thanks for the reply

I tried the command

find . -name *.log.* -mtime +90 -exec ls -tl {} \;

getting error Arg list too long

bash-2.03$ find . -name *.log.* -mtime +90 -exec ls -tl {} \;
bash: /usr/bin/find: Arg list too long

Thanks,
  #5 (permalink)  
Old 05-22-2008
incredible incredible is offline Forum Advisor  
Registered User
  
 

Join Date: May 2008
Location: s'pore
Posts: 2,061
your bash could be causing the problem or your dir might be over-growing
  #6 (permalink)  
Old 05-22-2008
cvdev cvdev is offline
Registered User
  
 

Join Date: May 2008
Posts: 8
Tried with out bash

$ find . -name *.log.* -mtime +90 -exec ls -tl {} \;
ksh: /usr/bin/find: arg list too long

getting the same error

Directory has different type of files
like

*.log
*.log.20080502124557
  #7 (permalink)  
Old 05-22-2008
incredible incredible is offline Forum Advisor  
Registered User
  
 

Join Date: May 2008
Location: s'pore
Posts: 2,061
try this?
$ find . -name *.log -mtime +90 -exec ls {}\;
Sponsored Links
Closed Thread

Bookmarks

Tags
mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:25 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0