Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E95B5DBC8 for ; Mon, 22 Oct 2012 21:57:47 +0000 (UTC) Received: (qmail 326 invoked by uid 500); 22 Oct 2012 21:57:43 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 173 invoked by uid 500); 22 Oct 2012 21:57:43 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 166 invoked by uid 99); 22 Oct 2012 21:57:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Oct 2012 21:57:43 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of adi@cloudera.com designates 209.85.223.176 as permitted sender) Received: from [209.85.223.176] (HELO mail-ie0-f176.google.com) (209.85.223.176) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Oct 2012 21:57:36 +0000 Received: by mail-ie0-f176.google.com with SMTP id k11so5061343iea.35 for ; Mon, 22 Oct 2012 14:57:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding:x-gm-message-state; bh=Ux8bCBI03+CMAzkwHtQDASUV8m4rqLFDs8lKFf4s9vU=; b=BNrEsPdByGN+RLSW9HMVNjzqCeNK0vUW5nyGAZzsXutZRzF7YrHLkIh6kGDJdV3zGD JV5ZwVKq6cX3FQY+cDn69LI4wA89Mz3d8ItCkE5ib6k2uioDreY8xasPoSWwXNpHeg7w wH2bQZoSgAyh0g0PspYO6T89QiepV7tlRV2+DM3oIe8mjrnTdNJgD3mt8GjpNxmdOdwS JuWS1viAhMBzn3JaIRpr03ayVwPAB1z5jQQn3gJU2oljEdSJykVCo5TBjupaUURn9Xts cKJjxwgyynuIwLxRDgJVUokhxVyGRTj9EYUL8RWjd1eSv1toxayUUOTIdvgL8iyZj9ji 2rlA== MIME-Version: 1.0 Received: by 10.50.40.133 with SMTP id x5mr18064949igk.32.1350943036131; Mon, 22 Oct 2012 14:57:16 -0700 (PDT) Received: by 10.64.124.3 with HTTP; Mon, 22 Oct 2012 14:57:16 -0700 (PDT) In-Reply-To: References: Date: Mon, 22 Oct 2012 14:57:16 -0700 Message-ID: Subject: Re: What is the command to see if a file is a directory or not in HDFS from bash? From: Andy Isaacson To: user@hadoop.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkNH0+/2lptMHhkz036sld++69Qa6ntfvx5ML6SNFrwggXrlzo/NuMHw6QOwgWvIp9JSBad X-Virus-Checked: Checked by ClamAV on apache.org 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 exa= mple: 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=E1 da Costa w= rote: > 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,