HDFS遍历子目录 Hadoop fs -ls -R path

本文详细介绍了Hadoop文件系统(HadoopFS)中的`hadoopfs -ls`命令及其各种选项,如 `-d`、`-h`、`-R`、`-t`、`-S` 和 `-r`。这些选项用于列出文件和目录,包括权限、大小、修改时间等信息,并提供了如何以不同方式排序和显示内容的方法。例如,`-h` 选项使文件大小以人类可读的形式显示,而 `-R` 选项则递归地列出目录内容。
摘要由CSDN通过智能技术生成

/hadoop fs -help cmd 可以看命令的介绍
hadoop fs -help ls
22/03/24 18:47:41 INFO conf.Configuration: Current hadoop.security.authentication = simple
-ls [-d] [-h] [-R] [-t] [-S] [-r] [-u] [ …] :
List the contents that match the specified file pattern. If path is not
specified, the contents of /user/ will be listed. For a directory a
list of its direct children is returned (unless -d option is specified).

Directory entries are of the form:
permissions - userId groupId sizeOfDirectory(in bytes)
modificationDate(yyyy-MM-dd HH:mm) directoryName

and file entries are of the form:
permissions numberOfReplicas userId groupId sizeOfFile(in bytes)
modificationDate(yyyy-MM-dd HH:mm) fileName

-d  Directories are listed as plain files.
-h  Formats the sizes of files in a human-readable fashion
    rather than a number of bytes.
-R  Recursively list the contents of directories.
-t  Sort files by modification time (most recent first).
-S  Sort files by size.
-r  Reverse the order of the sort.
-u  Use time of last access instead of modification for
    display and sorting.

-d目录以普通文件形式显示。
-h以人类可读的方式格式化文件大小,而不是字节数。
-R递归列出目录的内容。-t根据修改时间(最近的先修改)对文件进行排序。
-S按大小对文件排序。
-r颠倒排序的顺序。使用最后一次访问的时间,而不是修改显示和排序。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值