The UNIX and Linux Forums  

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
Find files older than x days and create a consolidated single tar file. Dawn Bosch SUN Solaris 3 09-09-2008 06:45 AM
number of working days rahulkav Shell Programming and Scripting 1 08-20-2008 05:56 AM
Find the file from 15 days ago YoungBlood Shell Programming and Scripting 2 03-03-2007 07:28 PM
Find number of days and list out the dates in between Raynon Shell Programming and Scripting 2 02-12-2007 08:52 PM
find the highest number in the file systemali Shell Programming and Scripting 30 03-23-2006 01:31 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-14-2009
prakash.gr prakash.gr is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 34
Find N number of days old file on solaris

Hi,


Code:

bash-3.00$ ls -ltr
total 8471258
-rw-r--r--   1 mysql    mysql       1227 Jul  7 22:33 information_schema.sql
-rw-r--r--   1 mysql    mysql     479762 Jul  7 22:49 mysql.sql
-rw-r--r--   1 mysql    mysql    1974789 Jul  7 22:50 youconnect.sql
-rw-r--r--   1 mysql    mysql       1355 Jul 10 16:22 crms.sql
-rw-r--r--   1 mysql    mysql        531 Jul 11 11:43 prakash
-rw-r--r--   1 mysql    mysql    2163607718 Jul 12 23:40 12-07-09.sql
-rw-r--r--   1 mysql    mysql    2169037247 Jul 13 23:40 13-07-09.sql



bash-3.00$ find /mysql1/mysqlbackup/ -type f -mtime +1 -exec ls -l {} \;
-rw-r--r--   1 mysql    mysql       1227 Jul  7 22:33 /mysql1/mysqlbackup/information_schema.sql
-rw-r--r--   1 mysql    mysql       1355 Jul 10 16:22 /mysql1/mysqlbackup/crms.sql
-rw-r--r--   1 mysql    mysql     479762 Jul  7 22:49 /mysql1/mysqlbackup/mysql.sql
-rw-r--r--   1 mysql    mysql    1974789 Jul  7 22:50 /mysql1/mysqlbackup/youconnect.sql
-rw-r--r--   1 mysql    mysql        531 Jul 11 11:43 /mysql1/mysqlbackup/prakash
bash-3.00$ date
Tue Jul 14 15:03:15 IST 2009
bash-3.00$ uname -a
SunOS webcast 5.10 Generic_127127-11 sun4v sparc SUNW,SPARC-Enterprise-T5120


So here why 2163607718 Jul 12 23:40 12-07-09.sql this file is not showing
in above find command.

Aappreciated any inputs.

Thanks

Prakash GR
  #2 (permalink)  
Old 07-14-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,811
Quote:
-mtime n
File was last modified n*24 hours ago. When find figures out how many 24-hour periods ago the file was last modified, any fractional part is ignored, so to match -mtime +1, a file has to have been modified at least two days ago.
This is from my man page for find.
  #3 (permalink)  
Old 07-14-2009
prakash.gr prakash.gr is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 34
Hi,

Thx for your reply.

I backup these files on regularly basis (that is *.sql) and won't be modified and my requirement is check file in /mysql1/mysqlbackup/ directory if any files are more than 2 day it should delete.

How can i achive this.

Thanks

Prakash GR
  #4 (permalink)  
Old 07-14-2009
dennis.jacob dennis.jacob is offline Forum Advisor  
dj - the student
  
 

Join Date: Feb 2007
Location: Singapore/Bangalore/Cochin
Posts: 611
Try:


Code:
find /mysql1/mysqlbackup/  -name "*.sql" -type f -mtime +2 -exec rm -f {} \;

Reply

Bookmarks

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 11:32 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