Question: how to check if a file exists in hdfs or not?
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 $?