thx soft2050 but i'm getting this error :

Parse error: syntax error, unexpected T_FOREACH on line

foreach (glob("$location\*") as $thefolder) {

* tried the direct location as well path/folder/ instead of $location

@ Humour - its working tho i'm getting "...foldername"