我想检查hdfs路径上是否存在遵循模式的文件。我正在尝试使用以下命令:
hadoop fs -test -e /user/foo/bar/abc*
但是它的抛出错误:
test: `/user/foo/bar/abc*': No such file or directory
对于以下问题,我尝试同时使用双引号和单引号,但仍然是同一问题: Hadoop HDFS copy with wildcards?
hadoop fs -test -e "/user/foo/bar/abc*"
test: `/user/foo/bar/abc*': No such file or directory
hadoop fs -test -e '/user/foo/bar/abc*'
test: `/user/foo/bar/abc*': No such file or directory
答案 0 :(得分:0)
对于具有通配符或需要扩展的情况,您需要用双引号将文字或路径加引号。
尝试一下...
long start = System.currentTimeMillis();
byte[] bytes = String.valueOf(666).getBytes();
// use 20 mb of memory for the output buffer
int size = 20 * 1000 * 1000 / bytes.length;
byte[] outBuffer = new byte[size * bytes.length];
// fill the buffer which is used for System.out.write()
for (int i = 0; i < size; i++) {
System.arraycopy(bytes, 0, outBuffer, i * bytes.length, bytes.length);
}
// perform the actual writing with the larger buffer
int times = 10_000_000 / size;
for (int i = 0; i < times; i++) {
System.out.write(outBuffer, 0, outBuffer.length);
}
long end = System.currentTimeMillis();
System.out.println();
System.out.println("Took " + (end - start) + "Millis");