find files older than 10 min - script/cmd problem

Hi guys,

Working on a 8.1-PRERELEASE and having problems with 1 find cmd:
Code:
find /path/ro/folder -type d -depth 1 -mmin -10

The idea of the script is that if there are files older that 10 min, a rsync is started, else the script just exists. It will be run from crontab every 10 min.

The problem is that if I create a file in that dir, the find cmd will not discover it. I;ve been hitting my head against the wall since yesterday and I also tried -atime, -mtime, with several combinations of days, hours, minutes but couldn't find a proper option to use.

Can anyone lend a hand here ?
 
Create a file at the end of the script, then use the "-newer" parameter during the find, delete the file, create it again?
Code:
 find /path -newer /filenew -exec rsync... ...  # needs improvement and/or xargs... 
/bin/rm /filenew
touch /filenew
 
Code:
-type d

Refer to the man page for find. You should not be using the type option like that, unless you only want to match directories? Use
Code:
-type f
or
Code:
! -type d

As always test your find command with
Code:
-print
on the end first to make sure it matches what you want. Then work on your exec/xargs syntax to do the rsync.
 
jb_fvwm2 said:
Create a file at the end of the script, then use the "-newer" parameter during the find, delete the file, create it again?
Code:
 find /path -newer /filenew -exec rsync... ...  # needs improvement and/or xargs... 
/bin/rm /filenew
touch /filenew

I quite often touch myself (oo-er!) then you don't need a sentinel.

Code:
find /blah -newer "$0" ...
touch "$0"
 
Back
Top