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 > 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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with find command when used with mtime arunkumar_mca UNIX for Dummies Questions & Answers 4 01-08-2008 12:37 AM
strange problem in finf with mtime arunkumar_mca UNIX for Dummies Questions & Answers 6 12-24-2007 10:04 AM
problem with find and mtime arunkumar_mca UNIX for Dummies Questions & Answers 4 11-05-2007 07:41 AM
mtime ravi raj kumar Shell Programming and Scripting 7 03-01-2007 08:54 PM
mtime help!!!!! scooter17 UNIX for Dummies Questions & Answers 2 09-12-2006 02:24 PM

Closed Thread
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 12-18-2007
manas_ranjan's Avatar
manas_ranjan manas_ranjan is offline
Registered User
  
 

Join Date: Jul 2007
Location: Amsterdam
Posts: 177
problem in mtime

Hey champs,


i am using the following commands to search 1day files available under a dir by shell script.

find <dirname> -type f -mtime +1

sometimes it used to show me correct results.....but sometimes it's not ???

if the above one not working perfect i.e. not showing me the exact files .

then i used to issue the following one,

find <dirname> -type f -mtime 1

surprisingly it works fine ........

SO can anyone help me why so strange is happening??? and how can i get the exact file name
under certain dir of 1day older.....
  #2 (permalink)  
Old 12-18-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Are you looking for files less than 24h:00m:00s old?
Code:
touch -t 12171100.01 testfile
find . -newer testfile
file 24:00:00:00 -> 48:00:00 old? between 1 -2 days old.
Code:
touch -t 12161100.01 oldfile
touch -t 12171100.01 newfile

find . -newer newfile  -a ! -newer oldfile
It's not clear to me what you want...
  #3 (permalink)  
Old 12-24-2007
manas_ranjan's Avatar
manas_ranjan manas_ranjan is offline
Registered User
  
 

Join Date: Jul 2007
Location: Amsterdam
Posts: 177
why find command is not giving the expected output everyday????

let CLSS is my home dir, under that 5 sub dir(s) are there.
i have a script which loop thru all the sub-folders available under CLSS,
then i issue the following command to get 1day older files.

find . -mtime +1 -type f -exec ls -1 {} \;

then i have to remove those files.
But for some sub-folders it is giving me correct result....but for some not as expected ???

so if i used find . -mtime 1 -type f -exec ls -1 {} \; => gives me perfect results .

system date
Wed Dec 26 01:43:57 SGT 2007

folder name
/app/cbf/CLSS/CSPAT104/decisions
-rw-r--r-- 1 xx XXX 128 Dec 24 13:23 CSPAT104_0712241323.decision
comand issued
[decisions]$ find . -mtime +1 -type f => doesn't retun the file name even though 24Hrs crosed
[decisions]$ find . -mtime 1 -type f => giving the actual
./CSPAT104_0712241323.decision


So why this one is happening ??? and is there any proper find command which i can apply in the script to get the expected results ???
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 10:16 AM.


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