Operating System - HP-UX
1845330 Members
2754 Online
110244 Solutions
New Discussion

find -mtime +1 nor working

 
SOLVED
Go to solution
Duffy_1
New Member

find -mtime +1 nor working

Hi,

Am trying to display (and later delete) files from /var/tmp. The files I want to find are of the form o*.tmp
I am using this command:

find o*.tmp -mtime +1 -print

This command finds no matching files , yet there are files that meet the criteria. I am really interested in the files that are more than one day old.
What am I doing wrong?

Thanks

-rw-r--r-- 1 oracle dba 0 Jan 22 15:04 l0011623.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 06:31 l0011631.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 06:14 l0011651.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:50 l0011691.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 14:04 l0011852.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 22 11:33 l0011853.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:47 l0011873.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 22 11:48 l0011875.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:49 l0011877.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 22 10:25 l0011878.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:34 l0011879.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 06:49 l0011893.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 04:59 l0011894.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 14:34 l0011915.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 16:28 l0011918.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 15:34 l0011919.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 08:49 l0011921.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 15:04 o0011623.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 06:31 o0011631.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 06:14 o0011651.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:50 o0011691.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 14:04 o0011852.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 22 11:33 o0011853.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:47 o0011873.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 22 11:48 o0011875.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:49 o0011877.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 22 10:25 o0011878.tmp
-rw-r--r-- 1 oradevl dba 0 Jan 24 08:34 o0011879.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 06:49 o0011893.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 04:59 o0011894.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 16:28 o0011918.tmp
-rw-r--r-- 1 oracle dba 0 Jan 22 15:34 o0011919.tmp
-rw-r--r-- 1 oracle dba 0 Jan 24 08:49 o0011921.tmp
10 REPLIES 10
Patrick Wallek
Honored Contributor
Solution

Re: find -mtime +1 nor working

The first thing to try is to be sure and quote your file name string and use correct find syntax.

Try this:

find /var/tmp -name "o*.tmp" -mtime +1 -print

James R. Ferguson
Acclaimed Contributor

Re: find -mtime +1 nor working

Hi Duffy:

I think you mean:

# find . -name "o*.tmp" -mtime +1 -print

Thaqt is, add the '-name' and double quote the argument to it so that the shell does not interpret it too!

Regards!

...JRF...
Duffy_1
New Member

Re: find -mtime +1 nor working

Ok,

I tried: find /var/tmp -name "o*.tmp" -mtime +1 -print but it stil finds no files.
Yarek
Regular Advisor

Re: find -mtime +1 nor working

Hi,


What is the output of your command?

Please check date settings on your system.
What is the output of 'date' command?


rgds.
jaroslaw
Peter Godron
Honored Contributor

Re: find -mtime +1 nor working

Hi Duffy,
and welcome to the forums !
Can you check you get something with:
ls -l o*.tmp

If not can you check with:
ls -lb *o*.tmp

The additional -b may reveal unprintable characters ( see "man ls" )

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Duffy_1
New Member

Re: find -mtime +1 nor working

The date command yields:

# date
Wed Jan 24 09:37:38 EST 2007
/var/tmp # find . -name "o*.tmp" -mtime +1 -print

The find command yields no output. Does the fact that the files have 0 bytes have any significance?

Thanks
spex
Honored Contributor

Re: find -mtime +1 nor working

Hello,

What does:
# find /var/tmp -name "o*.tmp" -print
(no '-mtime' primary) return?

PCS
James R. Ferguson
Acclaimed Contributor

Re: find -mtime +1 nor working

Hi (again):

Using '-mtime +1' means that the age must be more than 1 (integer truncated) days old. Based upon the data you show, you probably want to use:

# find . -type f -name "o*.tmp" -mtime +0 -print

In fact, I prefer to create my own reference point (file) and do:

# touch -mt 01230948 #...about 24-hours ago my time...
# find . -type f -name "o*.tmp*" ! -newer /tmp/myref

Regards!

...JRF...
Duffy_1
New Member

Re: find -mtime +1 nor working

the command find . -type f -name "o*.tmp" -mtime +0 -print
worked. I did not realize the "truncated integer" part of the mtime command.

Thanks to all who took time out of their busy schedules to relpy.

Duffy_1
New Member

Re: find -mtime +1 nor working

find . -type f -name "o*.tmp" -mtime +0 -print