Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
MapReduce >> mail # user >> Re: What is the command to see if a file is a directory or not in HDFS from bash?


Copy link to this message
-
Re: What is the command to see if a file is a directory or not in HDFS from bash?
BTW, while verifying this behavior I noticed that there is a bug in
Hadoop 2.0 "dfs -test -d", it generates error messages when it should
be silent.  I filed the bug at

https://issues.apache.org/jira/browse/HDFS-4104

-andy

On Mon, Oct 22, 2012 at 2:57 PM, Andy Isaacson <[EMAIL PROTECTED]> wrote:
> The result is reported in the shell exit code, not as a textual output
> from the command, just like the UNIX /usr/bin/test command.
>
> The intended use case is something like the following Bourne/bash shell example:
>
> if test -d /opt; then
>    ... install in /opt
> else
>    ... install in /usr
> fi
>
> or using the /usr/bin/[ synonym available on most systems,
>
> if [ -d /opt ]; then ...
>
> Similarly,
>
> if hadoop dfs -test -e something.txt; then
>    echo "something.txt exists on hdfs"
> else
>    echo "something.txt does not exist on hdfs"
> fi
>
> -andy
>
> On Mon, Oct 22, 2012 at 2:09 AM, Pedro Sá da Costa <[EMAIL PROTECTED]> wrote:
>> I execute  'hadoop-1.0.3/bin/hadoop dfs -test -d
>> /user/xeon/gutenberg/A.txt' command in the bash, and I was expecting
>> getting the value 0 or 1, but I got nothing.
>>
>> What is the command to launch from the bash that allows to check if a
>> file in HDFS is a file or directory?
>>
>> --
>> Best regards,
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB