problem in mtime


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem in mtime
# 1  
Old 12-18-2007
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 ........Smilie

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  
Old 12-18-2007
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  
Old 12-24-2007
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 ???
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find -mtime +7

Dear all, find $ADMIN_DIR/$SID/arch/ -name '*.gz' -mtime +7 -exec rm {} \; is it retaining 7 days OR 8 days .gz files ? Thanks Prakash (10 Replies)
Discussion started by: prakashoracledb
10 Replies

2. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

3. AIX

-mtime Problem

Hi, I'm using command "find . -mtime +10 -type f -print" to list the files 10 days or older but I'm getting the files which are even created today. What am I doing wrong? Thanks. (1 Reply)
Discussion started by: Gbyte
1 Replies

4. Shell Programming and Scripting

mtime

Hi, I've some files of some past days and everyday some new files are also getting added to the same. Now how can i use mtime to get the files of the current date i.e if i want the files of 25th feb 2009 and if im finding the files on 25th 12:10 am then i should only get the files after... (4 Replies)
Discussion started by: ss_ss
4 Replies

5. UNIX for Dummies Questions & Answers

-mtime +30

Hello, Can someone help me to understand the following: find /test/rman/ -mtime +30 -exec rm '{}' \; What does -mtime +30 mean? Thanks! (1 Reply)
Discussion started by: Blue68
1 Replies

6. UNIX for Dummies Questions & Answers

Problem with find command when used with mtime

All, Please find the below comand . I am trying to list the file that has not been accesed is past 14 days . But when you look at the display the directory "crecv1" which has date as today is displayed .. Why it is happening . I send this code instead of ls -ltr as rm -f -r in production... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

7. UNIX for Dummies Questions & Answers

strange problem in finf with mtime

Hi All, When i do ll , i saw the below list ll total 144512 drwxr-xr-x 2 weftp usr 8192 May 1 2007 weftp drwxrwxrwx 3 wetp usr 24576 Dec 23 20:45 weftp drwxrwxrwx 2 erer1 usr 8192 Nov 6 09:28 itm -rwxrwxrwx 1 stj usr 1006258 Sep 19 15:33... (6 Replies)
Discussion started by: arunkumar_mca
6 Replies

8. UNIX for Dummies Questions & Answers

problem with find and mtime

I am using HP-UNIX , The below command doesnt display anything although i have changed a file in the directory by toutch -t 200010101800 nfile find /tmp/transfer/ -name "*.*" -mtime +1 Any problrm with the find command i written . .Please help ??.. Thanks, Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

9. Shell Programming and Scripting

mtime

hi, :) consider the following statement find . -type f -mtime -1 -print here what is the use of -1 option. any help? cheers RRK (7 Replies)
Discussion started by: ravi raj kumar
7 Replies

10. UNIX for Dummies Questions & Answers

mtime help!!!!!

thank you for the help. (2 Replies)
Discussion started by: scooter17
2 Replies
Login or Register to Ask a Question