# /usr/bin/find: Argument list too long.



## Speedy (Oct 27, 2010)

I have a bunch of cameras that upload shots via FTP when motion is detected. I've a simple script to manage those files. Generally, I want them moved on daily basis and eventually deleted. However, sometimes there are too many files and I get mail from cron with error message: /usr/bin/find: Argument list too long. The line from script is below, any ideas how to work around it?

```
/usr/bin/find $PDIR/front/* -mtime +1h1m -exec mv {} $PDIR/yesterday/front \;
```


----------



## wblock@ (Oct 27, 2010)

Speedy said:
			
		

> I have a bunch of cameras that upload shots via FTP when motion is detected. I've a simple script to manage those files. Generally, I want them moved on daily basis and eventually deleted. However, sometimes there are too many files and I get mail from cron with error message: /usr/bin/find: Argument list too long. The line from script is below, any ideas how to work around it?
> 
> ```
> /usr/bin/find $PDIR/front/* -mtime +1h1m -exec mv {} $PDIR/yesterday/front \;
> ```



The first parameter to find(1) is the directory to search.  With that star, the shell is going to expand that to every file in that directory.  So, based on a cursory, millimeter-deep examination of the code, I'd say lose the star.


----------



## anomie (Oct 27, 2010)

Yup. The star (*) is redundant anyway. (Unless you're specifically trying to avoid traversing hidden files/directories under that path.)


----------



## Speedy (Oct 29, 2010)

Thanks for replies.


```
/usr/bin/find $PDIR/front/ -type f -mtime +1h1m -exec mv {} $PDIR/yesterday/front \;
```

This seems to work.


----------

