I have a security camera that I want the JPGs courtesy of Fwink kept off site...

Although apparently I am getting rusty with php...

I tried
Code:
<? php
if(time() >= file_get_contents('time.txt')+10){
	$a = 'camshots/' . date('y') . '/' . date('m') . '/' . date('d') . '/' . date('H.i.s') . '.jpg';
	copy('camshots/webcam.jpg',$a);
	file_put_contents('time.txt',time());
}
?>
That created a file in the main directory that looked sorta like "camshots/10/09/16/5.10.55.jpg"

So I tried adding
Code:
	if(!file_exists('camshots/' . date('y') . '/' . date('m') . '/' . date('d') . '/'))
		mkdir('camshots/' . date('y') . '/' . date('m') . '/' . date('d') . '/' );
before the copy code however that just made the script non responsive...

Any suggestions?
Better methods?
Leaner code to do it?

Thanks in advance