我如何递归列出HDFS的子目录? [英] How can I list subdirectories recursively for HDFS?
本文介绍了我如何递归列出HDFS的子目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ p $ find $ / $ / $ / $ b
但是我想得到HDFS的类似的东西。
hadoop dfs -lsr / dirname 命令递归列出目录内容。
要只过滤目录,您可以输出
要只过滤目录,您可以输出
grep
drwx(因为所有者对目录具有rwx权限)以上命令。 因此整个命令将如下所示。
$ hadoop dfs -lsr / sqoopO7 | grep drwx
I have a set of directories created in HDFS recursively. How can list all the directories ? For a normal unix file system I can do that using the below command
find /path/ -type d -print
But I want to get the similar thing for HDFS.
解决方案
To list directory contents recursively hadoop dfs -lsr /dirname
command can be used.
To filter only directories , you can grep
"drwx" (since owner has rwx permission on directories) in output of above command.
Hence whole command will look like as below.
$hadoop dfs -lsr /sqoopO7 | grep drwx
这篇关于我如何递归列出HDFS的子目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文