add if ($f != "." && $f != "..") check to directory loop