Using the find command

AnnesAnnes Tripped Up by Libidos and HubrisAlexandria, VA Icrontian
edited October 2006 in Science & Tech
For a script I'm writing I need to fins out which files have been modified in the last 2 hours and output the filenames (directory and all) into a file. So I'm using the find command like this:

find /home/www/ -mmin -120

and am getting the right information for the output, only problem is that it's also giving me the directory paths and not just the files. Here's some sample output:

/home/www/intranet/info-research/illref
/home/www/intranet/info-research/illref/librarysearch.php

The first entry is the one I would like to eliminate. I want to do this because the output file that is created is going to be used as the distfile for rdist so we can copy the most recently modified files to a backup server every 2 hours, and I don't want it to be grabbing entire directories at once if only one file in said directory has been modified.

If you have an answer for this or a suggestion on how to do it better, I would really appreciate it. Thanks.

Comments

  • LeonardoLeonardo Wake up and smell the glaciers Eagle River, Alaska Icrontian
    edited October 2006
    Are you referring to an operation for a Linux distro?
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited October 2006
    leo - yes.

    check the man pages for find (man find), specifically the "-type" argument.
  • AnnesAnnes Tripped Up by Libidos and Hubris Alexandria, VA Icrontian
    edited October 2006
    Yeah, I figured it out shortly after I posted this...sorry for not coming back to tell you guys.

    shwaip was right on the money, I didn't RTFM close enough and -type f is the modifier I needed.
Sign In or Register to comment.