Operating System - HP-UX
1827136 Members
2995 Online
109716 Solutions
New Discussion

finding files for a particular date

 
SOLVED
Go to solution
Shivkumar
Super Advisor

finding files for a particular date

How to find a file or directory created datewise in all the file system on hpux server ?

I mean i need to find files created on a particular date ?

Any help appreciated.

Thanks and regards,
Shiv
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: finding files for a particular date

Use touch to create reference files with dates that surround your target date - i.e. one day before and one day after. Then use find with it's newer option and it's negative - not newer (! -newer) to search out the files between the two dates.


Pete

Pete
Mel Burslan
Honored Contributor

Re: finding files for a particular date

touch -t time /tmp/dummy # see "man touch" for time format
find / -newer /tmp/dummy | xargs ls -l > /tmp/newer_filelist

by modifying the touch date you can control the creation date. Then you need to sort this output according to date to get the single date you want on the top.

HTH
________________________________
UNIX because I majored in cryptology...
Cem Tugrul
Esteemed Contributor

Re: finding files for a particular date

Hi Shiv,

how about this fresh link?

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=946914

Good luck,
Our greatest duty in this life is to help others. And please, if you can't
Pete Randall
Outstanding Contributor

Re: finding files for a particular date

Here's the actual commands for the method I suggested:

touch -t CCYYMMDDHHMM day_before_file
touch -t CCYYMMDDHHMM day_after_file

find /start_dir \( -newer day_before_file -a ! -newer day_after_file \) -exec ll {} \;


Pete

Pete
Cem Tugrul
Esteemed Contributor

Re: finding files for a particular date

another link;

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=181099

Good luck,
Our greatest duty in this life is to help others. And please, if you can't
Rick Garland
Honored Contributor
Solution

Re: finding files for a particular date

Starting from the / directory;

ls -laR | awk '{if (($6 == "May") && ($7 == "1")) print $0}'

A recursive listing through the directories. Change the $6 & $7 values to your specs.


john korterman
Honored Contributor

Re: finding files for a particular date

Hi,

hmmm, how to break the bad news...

Keep in mind that unix does not store any information about the creation date of files.
When a file is created the timestamp for inode information (access rights, ownership etc.) is registered, and looking at this may be your nest chance.
This of course assumes that inode information has not been changed since creation - rather doubtful - but it is probably your best chance. Try Pete Randall's find suggestion adding the -ctime option.

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