1820475 Members
3005 Online
109624 Solutions
New Discussion юеВ

finding files in HP-UX

 
SOLVED
Go to solution
Kudlaty
Occasional Contributor

finding files in HP-UX

Hellow,
I have a problem. I need find few files which was created in last 5 min but I don't now haw do it. I hope that somebady can help me.
(Sorry for my english :-) )

Kudlaty
7 REPLIES 7
Ian Dennison_1
Honored Contributor

Re: finding files in HP-UX

Find a file that was created 5 minutes before the one you wish to find. The /tmp directory would be good for this, perform an 'll -lt |head'.

Then use the 'find /directory -newer [filename]' command.

Share and Enjoy! Ian
Building a dumber user
Leif Halvarsson_2
Honored Contributor

Re: finding files in HP-UX

Hi,
If you have a file , modified (or created) just before the files you want to find.

find . -newer
Stefan Farrelly
Honored Contributor
Solution

Re: finding files in HP-UX


You need to do a few steps;

1. date to get the current date+time. If its equal to say May 27 10:45 then;
2. touch -m 05271040 /tmp/t
This creates a file 5 mins old in /tmp.
3. Now we can use find to compare /tmp/t to all current files to list those created in the last 5 mins;
cd
find . -newermm /tmp/t -print

Check the man page for find, you can change the mm after -newer to aa for access time (m = modified time) or cc for inode mod time.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Kudlaty
Occasional Contributor

Re: finding files in HP-UX

Ok. This way is good when I know files name. I want find all files which was created during last 5 minutes, but I dont know name of this files. I want use only one parameter: created time.

Thanks for yours help

Kudlaty
Stefan Farrelly
Honored Contributor

Re: finding files in HP-UX


There is no option with find to list files created in the last 5 mins, but the -newercc option lists inode modification and this will capture all files created in the last 5 mins, but may also add in a few others (but unlikely), so use this otion (-newercc)
Im from Palmerston North, New Zealand, but somehow ended up in London...
Tore_1
Regular Advisor

Re: finding files in HP-UX

download findutils from http://hpux.connect.org.uk/hppd/hpux/Gnu/findutils-4.1.5/

This includes gnu version of find which support -mmin option.
Jean-Louis Phelix
Honored Contributor

Re: finding files in HP-UX

hi,

Just a remark : the answer with a touch and a find -newer is the only 'short' solution in your case. You don't need to know the name of the files to do it :

# touch -m xxx /tmp/ref
# find / -newer /tmp/ref

The only problem is that on unix you can NEVER know when a file was CREATED. Only when it was last modified.

To get files CREATED, you have to manage an 'index' file every 5 minutes and then use diff or comm on index before and current.

Regards.
It works for me (┬й Bill McNAMARA ...)