【发布时间】:2014-07-31 08:32:26
【问题描述】:
我想测试一个目录是否存在于 Hadoop 分布式文件系统 (HDFS) 中。如果目录不存在,我想创建它,否则什么都不做。
当我在http://jugnu-life.blogspot.com/2012/10/hadoop-fs-test-example.html修改代码时:
#!/bin/bash
directory=/raw/tool/
if hadoop fs -test –d $directory ; then
echo "Directory exists"
else
hadoop fs -mkdir $directory
echo "Creating directory"
fi
我得到错误:
-test: Too many arguments: expected 1 but got 2
Usage: hadoop fs [generic options] -test -[defsz] <path>
我做错了什么?
【问题讨论】:
标签: bash hadoop mapreduce hdfs