Hi Guys,
My unix is SunOS. I like to find all the files which are created 1 day back.
i tried the following command
find . -type f -name '*.aud' -mtime +1
This gives me all the files created 48 hours back (2 days) but not one..
Can you let me know where i am going wrong.
Thanks,
Magesh
methyl
September 15, 2009, 6:06am
2
find . -type f -name '*.aud' -mtime -1
(Gives you all files modified in the last 24 hours)
If this doesn't match your requirement, please give examples relative to a given date and time.
thegeek
September 15, 2009, 6:11am
3
man find
-atime n
File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, any
fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago.
Even though you specify +1, it is atleast two days as per the man page.
So if "-1" fits your requirement, use that.,
Hi methyl.
The folder i am looking into is havin aournd 5000 files..
{oracle:/u01/app/oracle/product/9.2.0.6.0_64/rdbms/audit}$ ls -ltr
total 10018
-rw-r----- 1 oracle sysdbora 1186 Jan 14 2006 ora_6736.aud
-rw-r----- 1 oracle sysdbora 781 Jan 14 2006 ora_6793.aud
-rw-r----- 1 oracle sysdbora 1186 Jan 14 2006 ora_6830.aud
-rw-r----- 1 oracle sysdbora 644 Jan 14 2006 ora_6879.aud
-rw-r----- 1 oracle sysdbora 637 Jan 14 2006 ora_8716.aud
-rw-r----- 1 oracle sysdbora 918 Jan 14 2006 ora_8827.aud
-rw-r----- 1 oracle sysdbora 644 Jan 14 2006 ora_8858.aud
-rw-r----- 1 oracle sysdbora 637 Jan 14 2006 ora_8859.aud
-rw-r----- 1 oracle sysdbora 637 Jan 14 2006 ora_8917.aud
-rw-r----- 1 oracle sysdbora 1190 Jan 14 2006 ora_11449.aud
-rw-r----- 1 oracle sysdbora 646 Jan 14 2006 ora_11486.aud
-rw-r----- 1 oracle sysdbora 639 Jan 14 2006 ora_11487.aud
-rw-r----- 1 oracle sysdbora 776 Jan 14 2006 ora_12055.aud
-rw-r----- 1 oracle sysdbora 920 Jan 14 2006 ora_12382.aud
-rw-r----- 1 oracle sysdbora 646 Jan 14 2006 ora_12450.aud
-rw-r----- 1 oracle sysdbora 639 Jan 14 2006 ora_12451.aud
-rw-r----- 1 oracle sysdbora 639 Jan 14 2006 ora_12982.aud
{oracle:/u01/app/oracle/product/9.2.0.6.0_64/rdbms/audit}$ find . -type f -name '*.aud' -mtime -1
{oracle:/u01/app/oracle/product/9.2.0.6.0_64/rdbms/audit}$
methyl
September 15, 2009, 6:37am
5
I get one Oracle audit log every time a priviliged user connects to the database (for example for startup and shutdown). Because my database is stop/started daily for backup these logs accumulate rapidly and I normally only keep a week's worth. Similarly for Oracle alert logs, Oracle listener logs adn Oracle trace logs.
Your situation may be different.
What are you trying to do?
actually i am trying to extract data from all the files which are more than one day old..
So for that i want to find the files whcih are more than one day old...
try this code:
find . -type f -name '*.aud' -mmin +1440
hope it will work for you
regards,
Sanjay
i am getting this error..
find: bad option -mmin
find: path-list predicate-list
As i said mine is SunOS
methyl
September 15, 2009, 2:13pm
9
Second attempt.
actually i am trying to extract data from all the files which are more than one day old..
So for that i want to find the files whcih are more than one day old...
find . -type f -name '*.aud' -mtime +1
Try:
find . -type f -name '*.aud' -mtime +0