Question: how to check if file exists in hadoop?
Answer: Syntax: hdfs dfs -test -d hdfs_path. Example: hdfs dfs -test -d /revisit/content/files. echo $? —> to validate the previous command return code. Syntax : hdfs dfs -test -e hdfs_path/filename. Example: hdfs dfs -test -e /revisit/content/files/schema.xml. echo $?