<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: hdfs file exists check in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163109#M254374</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2696/bigdatasupernova.html" nodeid="2696"&gt;@bigdata.neophyte&lt;/A&gt; Here is the usage -&lt;/P&gt;&lt;P&gt;Usage: hadoop fs -test -[defsz] URI&lt;/P&gt;&lt;P&gt;Options:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;-d: f the path is a directory, return 0.&lt;/LI&gt;&lt;LI&gt;-e: if the path exists, return 0.&lt;/LI&gt;&lt;LI&gt;-f: if the path is a file, return 0.&lt;/LI&gt;&lt;LI&gt;-s: if the path is not empty, return 0.&lt;/LI&gt;&lt;LI&gt;-z: if the file is zero length, return 0.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;hadoop fs -test -e filename&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Check - &lt;A href="http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/FileSystemShell.html#test" target="_blank"&gt;http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/FileSystemShell.html#test&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2016 20:31:52 GMT</pubDate>
    <dc:creator>sshimpi</dc:creator>
    <dc:date>2016-08-03T20:31:52Z</dc:date>
    <item>
      <title>HDFS File Existence Check: Understanding and Using Shell Return Codes ($?)</title>
      <link>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163107#M254372</link>
      <description>&lt;P&gt;Hi, I am performing a basic check to see if a file exists in HDFS or not. I am using hdfs dos -test command for the same. But it doesn't seem to work correctly. In the documentation its mentioned as it would return 0 if the file exists. But I am not getting any output when the command is run. Let me know what need to be done to get this working. Please see the screenshot attached Thanks&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="virtualbox-hortonworks-sandbox-with-hdp-2png.jpg" style="width: 506px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/7151iB0B53FF6C93E42A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="virtualbox-hortonworks-sandbox-with-hdp-2png.jpg" alt="virtualbox-hortonworks-sandbox-with-hdp-2png.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2026 20:52:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163107#M254372</guid>
      <dc:creator>bigdata_superno</dc:creator>
      <dc:date>2026-05-12T20:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: hdfs file exists check</title>
      <link>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163108#M254373</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2696/bigdatasupernova.html" nodeid="2696"&gt;@bigdata.neophyte&lt;/A&gt; The hdfs command doesn't print the result but sets it's return code to the shell. You'll need to test the return code from the 'hdfs dfs -test' command. On Linux try this:&lt;/P&gt;&lt;PRE&gt;hdfs dfs -test -e /tmp
echo $?
hdfs dfs -test -e /this_doesnt_exist
echo $?&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Aug 2016 20:28:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163108#M254373</guid>
      <dc:creator>tstebbens</dc:creator>
      <dc:date>2016-08-03T20:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: hdfs file exists check</title>
      <link>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163109#M254374</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2696/bigdatasupernova.html" nodeid="2696"&gt;@bigdata.neophyte&lt;/A&gt; Here is the usage -&lt;/P&gt;&lt;P&gt;Usage: hadoop fs -test -[defsz] URI&lt;/P&gt;&lt;P&gt;Options:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;-d: f the path is a directory, return 0.&lt;/LI&gt;&lt;LI&gt;-e: if the path exists, return 0.&lt;/LI&gt;&lt;LI&gt;-f: if the path is a file, return 0.&lt;/LI&gt;&lt;LI&gt;-s: if the path is not empty, return 0.&lt;/LI&gt;&lt;LI&gt;-z: if the file is zero length, return 0.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;hadoop fs -test -e filename&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Check - &lt;A href="http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/FileSystemShell.html#test" target="_blank"&gt;http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/FileSystemShell.html#test&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 20:31:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163109#M254374</guid>
      <dc:creator>sshimpi</dc:creator>
      <dc:date>2016-08-03T20:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: hdfs file exists check</title>
      <link>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163110#M254375</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/50/tstebbens.html" nodeid="50"&gt;@Terry Stebbens&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 21:27:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163110#M254375</guid>
      <dc:creator>bigdata_superno</dc:creator>
      <dc:date>2016-08-03T21:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: hdfs file exists check</title>
      <link>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163111#M254376</link>
      <description>&lt;P&gt;Hi Team , Is there any way to test multiple files exist or not in single command?? like below.. pls suggest&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;hadoop fs -test -e filename1 filename2&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 15 Aug 2018 03:42:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/HDFS-File-Existence-Check-Understanding-and-Using-Shell/m-p/163111#M254376</guid>
      <dc:creator>srinu2044</dc:creator>
      <dc:date>2018-08-15T03:42:58Z</dc:date>
    </item>
  </channel>
</rss>

