:master:
Vado per tentativi ed errori anche io, ma proverei ad usare IS_DIR() all'interno del ciclo WHILE.