我需要找到输入文件夹位置是否存在于hadoop中。我使用下面的命令来做同样的事情
hadoop fs -test -d <folder Location>
查询不抛出任何错误,但也没有输出。我已经检查了它的正确和错误的位置。我从文档中了解到,如果位置正确,它应该输出1。
utugiqy61#
谢谢@mikhail golubtsov。使用上面的提示,我最后修改的shell脚本是
if hadoop fs -test -d $1 ; then echo "yeah it's there " else echo "No its not there." fi
yuvru6vn2#
hdfs dfs -test -d <folder location> 不会输出任何东西,比如 0 或者 1 . 关于退出状态, 0 表示目录存在时的正常情况。 1 表示缺少目录。下面是一个可以在bash中使用的示例:
hdfs dfs -test -d <folder location>
0
1
hdfs dfs -test -d /tmp && echo 'dir exists' || echo 'sorry, no such dir'
2条答案
按热度按时间utugiqy61#
谢谢@mikhail golubtsov。使用上面的提示,我最后修改的shell脚本是
yuvru6vn2#
hdfs dfs -test -d <folder location>
不会输出任何东西,比如0
或者1
. 关于退出状态,0
表示目录存在时的正常情况。1
表示缺少目录。下面是一个可以在bash中使用的示例: