# find files older than 10 min - script/cmd problem



## da1 (Jul 21, 2011)

Hi guys,

Working on a 8.1-PRERELEASE and having problems with 1 find cmd:

```
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 ?


----------



## jb_fvwm2 (Jul 21, 2011)

Create a file at the end of the script, then use the "-newer" parameter during the find, delete the file, create it again? 
	
	



```
find /path -newer /filenew -exec rsync... ...  # needs improvement and/or xargs... 
/bin/rm /filenew
touch /filenew
```


----------



## Petz (Jul 26, 2011)

```
-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 

```
-type f
```
 or 
	
	



```
! -type d
```

As  always test your find command with 
	
	



```
-print
```
 on the end first to make sure it matches what you want. Then work on your exec/xargs syntax to do the rsync.


----------



## bigearsbilly (Aug 5, 2011)

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?
> 
> 
> 
> ...



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


```
find /blah -newer "$0" ...
touch "$0"
```


----------

