Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"find " command

Status
Not open for further replies.

snowsmart

IS-IT--Management
May 24, 2005
37
CA
I need a script to list/copy all files ( which have been created in the last 2 hours) from one directory to another.

it seems that the "find" command only can search by day not by hour.

please help

thanks
 
What version of "find" do you have? Gnu find supports an "amin" qualifier:

-amin n
File was last accessed n minutes ago.

This looks like it will give you the results you want... if yo have or can get the gnu version.
 
touch a reference file, which timnestamp is 2hr back and use
find . -newer reffile -exec cp {} /dest/dir \;

Best Regards, Franz
--
System Manager (Solaris, HP-UX, Linux, some networking, some SAN)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top