hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Isaacson <...@cloudera.com>
Subject Re: What is the command to see if a file is a directory or not in HDFS from bash?
Date Mon, 22 Oct 2012 21:57:16 GMT
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
   ... install in /usr

or using the /usr/bin/[ synonym available on most systems,

if [ -d /opt ]; then ...


if hadoop dfs -test -e something.txt; then
   echo "something.txt exists on hdfs"
   echo "something.txt does not exist on hdfs"


On Mon, Oct 22, 2012 at 2:09 AM, Pedro Sá da Costa <psdc1978@gmail.com> 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,

View raw message