加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 以树状格式以修改时间递归列出文件

发布时间:2020-12-14 02:41:24 所属栏目:Linux 来源:网络整理
导读:我正在寻找一个命令来从给定目录递归列出所有文件及其修改时间.如果它能够以树形命令生成的树状格式生成输出也会很好. 注意:我正在运行Red Hat Enterprise Linux Server第5版. 编辑:树命令的选项-D仅打印过去几年的最后修改时间的日期部分,尽管它显示当前
我正在寻找一个命令来从给定目录递归列出所有文件及其修改时间.如果它能够以树形命令生成的树状格式生成输出也会很好.

注意:我正在运行Red Hat Enterprise Linux Server第5版.

编辑:树命令的选项-D仅打印过去几年的最后修改时间的日期部分,尽管它显示当前年份的时间.在这种情况下,我希望在过去的几年中打印日期.

解决方法

I’m looking for a single command to list all files recursively from a
given directory along with its modified time.

$find /path/to/folder -type f -print0 | xargs -0 ls -l --time-style="+%F %T"

It would also be nice if it can produce output in a tree-like format
as produced by tree command.
In my case,precision upto minutes is enough.

在我的CentOS上,Gentoo,… -D选项已在几分钟内显示:

$tree -D
.
├── [Jul 26 14:41]  LICENSE
├── [Jul 26 14:41]  manifests
│ ├── [Oct 10 16:30]  defines
│ │ └── [Jul 26 14:41]  redis source.pp
│ └── [Jul 26 14:41]  init.pp
├── [Jul 26 14:41]  README
└── [Jul 26 14:41]  templates
    ├── [Jul 26 14:41]  redis.conf.erb
    └── [Jul 26 14:41]  redis-server.erb

3 directories,6 files

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读