What do you mean by incorrect value?
If GetFileAttrib($file) & 16 evaluates to '0' then it's a file, otherwise it's a directory. What values do you get?
_________________________
There are two types of vessels, submarines and targets.