Operating System - HP-UX
1855697 Members
6006 Online
104103 Solutions
New Discussion

Re: Finding files created today??

 
SOLVED
Go to solution
Eric Antunes
Honored Contributor

Finding files created today??

I'm searching in a specific directory for files created today. Is this the correct approach (?):

find -ctime -1

Thanks,

Eric Antunes
Each and every day is a good day to learn.
5 REPLIES 5
Pete Randall
Outstanding Contributor
Solution

Re: Finding files created today??

Eric,

You'll be able to be much more specific if you use the -newer option. Touch a reference file:

touch -t 200502162359 /tmp/reftime1

Then use find:

find -newer /tmp/reftime1


If you need to limit the search, you can also use the "not newer" construct:

find ! -newer /tmp/reftime2


Pete

Pete
Eric Antunes
Honored Contributor

Re: Finding files created today??

Thanks Pete!

I found my way with:

find -ctime -1 -exec grep -l 'ORA-01403' {} \;

Eric
Each and every day is a good day to learn.
G. Vrijhoeven
Honored Contributor

Re: Finding files created today??

Hi Eric,

-1 is not older then 24 Hrs so this will also list files that were created yesterday.

you could use this:
ll $(find . -type f -ctime -1 2>/dev/null) | grep "$( date +'%b %d'
)"

HTH,

Gideon
Peter Godron
Honored Contributor

Re: Finding files created today??

Eric,
also the find files in a SPECIFIC directory you would need to add path and prune, otherwise find will search sub-directories as well.
Regards
Eric Antunes
Honored Contributor

Re: Finding files created today??

Thanks again!
Each and every day is a good day to learn.