Using the find command
Annes
Tripped Up by Libidos and HubrisAlexandria, VA Icrontian
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.
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.
0
Comments
check the man pages for find (man find), specifically the "-type" argument.
shwaip was right on the money, I didn't RTFM close enough and -type f is the modifier I needed.