Getting erros when running scripts from cron

I have a php script that I am running from command line just fine with no issues, but when it runs from cron I get the following error

/bin/sh: Shares: not found

the script looks for mkv files in a shared directory and moves them to another if they exist.

I have tried just about everything that I can think of to correct this and nothing works. If anyone has any ideas I would appreciate it.

here is the script… it is pretty basic…

[php]

<?php date_default_timezone_set('America/New_York'); logit("Checking for any new mkv files in completed torrents folder\n"); foreach (glob("/mnt/DroboFS/Shares/Media/Competed Torrents/*") as $filename) { if(stristr($filename, 'sample')) { continue; } if(is_dir($filename)){ foreach (glob($filename."/*") as $filename2) { $info2=pathinfo($filename2); if (time()-filemtime($filename2) > 3600 && $info2['extension']=="mkv") { $show=basename($filename2); logit("moving $show To weekly Shows.....\n"); if(rename($filename2, "/mnt/DroboFS/Shares/Media/Weekly Shows/".basename($filename2))){ logit("Complete\n"); }else{ logit("Failed\n"); } }else{ logit(basename($filename2)." not old enough yet\n"); } } } } logit(); function logit($msg=FALSE){ $h=fopen("/var/log/movemkv","a+"); fwrite($h,($msg?date('m/d/Y h:i:s a', time())." ".$msg:date('m/d/Y h:i:s a', time())." Check for new videos complete\n\n")); fclose($h); } ?>[/php]

“/mnt/DroboFS/Shares/Media/Competed Torrents/*”

Is the space in the directory path. PHP/glob doesn’t understand “space”

foreach (glob(’/mnt/DroboFS/Shares/Media/Competed\ Torrents/*’) as $filename)

or

foreach (glob("/mnt/DroboFS/Shares/Media/Competed\ Torrents/*") as $filename)

notice the single and double quote

(its a bit like the dark side in star wars) - theres no escape :smiley: