The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 09:37 AM
Little bit weired : Find files in UNIX w/o using find or where command jatin.jain Shell Programming and Scripting 10 09-19-2007 03:47 AM
command to find free disk space on solaris harishankar SUN Solaris 2 08-26-2007 08:47 AM
find command loops in a sun Solaris 8 cluster scottman UNIX for Advanced & Expert Users 2 06-19-2005 09:28 PM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 03:38 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-10-2001
Registered User
 

Join Date: Dec 2000
Posts: 1
Find command in Solaris

Hi folks,

I am DBA who needs some help with find command. We have a directory with files dated from January 1, 2001. Several files are created each day. We probably have several hundred files. I want to delete all files OLDER than 90 days (I want to keep files that are 90 days before today & delete everything older than that). I tried this:

find . +mtime 90 -exec rm |


I am missing something here. Could you folks help me out? Thanks.
Forum Sponsor
  #2  
Old 07-10-2001
alwayslearningunix
Guest
 

Posts: n/a
find . -type f -mtime +90 -exec rm {} \;

I would recommend moving or copying them elsewhere first before removing them - but this will do you what you want

Regards.
  #3  
Old 07-10-2001
Registered User
 

Join Date: Jul 2001
Location: Frankfurt/Germany
Posts: 21
find...

hi.

i think you have got an error, haven't you?

the syntax is:

find . -type f +mtime 90 -exec rm {} \;

but i think it is better you mave this things, or copy it first to another location.

find . +mtime 90 -print | xargs cp -R /savedir

cheers, alex...


  #4  
Old 07-10-2001
alwayslearningunix
Guest
 

Posts: n/a
No, the syntax is correct and works fine for me - in addition srolen wants files not only 90 days old, but files 90 days old and OLDER and hence +90 is needed. It is an "-" before the mtime, just like all other condition statement flags that work with find.

However you have introduced a more efficient means of doing this using xargs since -exec spawns a new process for each file it finds, whereas the former collects the files as multiple arguments to the rm (or whatever else) command.

Regards.

Last edited by alwayslearningunix; 07-10-2001 at 06:58 AM.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:34 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