Fixing directory code for posix platforms
Fixed posix directory scanning