title: Find whether file exists or not in HDFS using shell script
body: <p>I have a <code>shell script</code> like below. This script prints the path of a file located in <code>HDFS</code></p>
  
  <pre><code>#!/bin/bash
  
  TIMESTAMP=`date "+%Y-%m-%d"`
  path=/user/$USER/logs/${TIMESTAMP}.fail_log
  path1=/user/$USER/logs/`date -d "-1 days" '+%Y-%m-%d'`.fail_log
  
  echo filePath=$path
  echo filePath1=$path1
  </code></pre>
  
  <p>In the script the <code>paths</code> provided are <code>hdfs</code> locations</p>
  
  <p>In this script I am getting the filepath. </p>
  
  <p>Now I want to know whether the file actually exists or not in <code>HDFS</code>.</p>
  
  <p>If the file exists then only print the filepath or else do nothing. </p>
  
  <p>How can I do that?</p>