Operating System - HP-UX
1748028 Members
5097 Online
108757 Solutions
New Discussion юеВ

How to use find command to get the files created in 24h?

 
SOLVED
Go to solution
MA Qiang
Regular Advisor

How to use find command to get the files created in 24h?

find . -ctime 1 -exec ll {} \;
can only display the files created before 24h.
7 REPLIES 7
Peter Godron
Honored Contributor

Re: How to use find command to get the files created in 24h?

Hi,
create a file with the date you want to search from:
touch -t [[CC]YY]MMDDhhmm[.SS] ref.file
Then use the file:
find . -newer ref.file -exec ll {} \;
Regards

harry d brown jr
Honored Contributor

Re: How to use find command to get the files created in 24h?

find . -type f -ctime -1 -exec ll {} \;

The ll is not going to give you the date created, it will return the date last modified.

for ls look at the -a, -c and -u options.

live free or die
harry d brown jr
Live Free or Die
Peter Godron
Honored Contributor

Re: How to use find command to get the files created in 24h?

Hi,
as a follow up warning.

HPUX does not keep a log of when a file was created, only when it was modified.

So if you create a file, then modify it, it will update the date with the new date.
Operations using find will look at the modified date.

Regards
MA Qiang
Regular Advisor

Re: How to use find command to get the files created in 24h?

find . -mtime 1 -exec ll {} \;
can only get the files modified before 24h.

I just want to get the files created or modified in 24h.
harry d brown jr
Honored Contributor

Re: How to use find command to get the files created in 24h?


Then you need to write a program to do such.

live free or die
harry d brown jr
Live Free or Die
john korterman
Honored Contributor
Solution

Re: How to use find command to get the files created in 24h?

Hi,
is that what you want:
# find . -type f -mtime 0 -exec ll {} \;

regards,
John K.
it would be nice if you always got a second chance
MA Qiang
Regular Advisor

Re: How to use find command to get the files created in 24h?

Thank you! I got it.