Fixing file existence check to make it compatible with various hadoop releases and distributions 

hadoop fs -ls -d is not compatible with releases other than CDH4. This update should work in all versions.