This has something to do with resource forks. So use "-d filename/." instead, which returns false if filename is not a directory.