Hello

I am trying to use the find command to search for the last files modifyed under certain directory

Example: #find /tmp -mtime -1

find all the files modifyed from 1 hour ago

The question is: Somebody knows hou can I do the same but using minutes or seconds instead of hours.
I am new to scripting so I would apreciate any help

ls -1rt | tail Newest 10 files in a directory

Hi Rast,

To do this with find, try the -cmin switch:

-cmin n
              File’s status was last changed n minutes ago.

EDIT: Or you might be looking for this one:

-mmin n
              File’s data was last modified n minutes ago.

(I got this from the man page for find btw. This might be a new feature... haven't researched it that far yet.)

Hope this helps!
-G

Thanks for your help

The problem I have is that mmin is not supported in HP-UX that is the OS I have to program in.

The solution I found is to use the -newer option of the find command.

Regards

Ricardo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.