Use POSIX compatible test to test if a file is a directory