简体   繁体   English

如何列出所有文件的大小和上次修改日期?

[英]How do I list all files with their size and last modified date?

I would like to list all files in human readable format size and date stamp including files in sub-directories and sort it all by size.我想以人类可读的格式大小和日期戳列出所有文件,包括子目录中的文件,并按大小对其进行排序。 Currently I can do that with the code below:目前我可以用下面的代码做到这一点:

find /sasdata/ -name "*.sas7bdat" -exec ls -lthS  {} + | sort -r -h | awk '{print $3, $4, $5, $6, $7, $8, $9, $10,$11,$12,$13}' >> sasdata_all.txt &

It is sorted by size and not per folder.它按大小排序,而不是按文件夹排序。 I want it to sort all the files regardless of its path.我希望它对所有文件进行排序,而不管其路径如何。 How do I do that?我怎么做?

What about :关于什么 :

find . -printf '%s %p\n' | sort -h -r | head

which in my case outputs :在我的情况下输出:

120050424 ./go1.13.linux-amd64.tar.gz
25831312 ./Projects/Practica_SDL/include/Game.h.gch
25040336 ./Projects/Practica_SDL/include/Letter.h.gch
24216593 ./go/pkg/tool/linux_amd64/compile
16867656 ./journey-linux-amd64/journey
15075523 ./go/bin/go
14821094 ./go/pkg/tool/linux_amd64/pprof

File sizes are in bytes.文件大小以字节为单位。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用完整路径、大小、上次访问日期和上次修改日期递归列出文件? - How to list files recursively with complete path, size, last accessed date and last modified date? 如何递归列表文件的大小和上次修改时间? - How to recursive list files with size and last modified time? 如何列出(ls)目录中最后修改的 5 个文件? - How can I list (ls) the 5 last modified files in a directory? 如何创建 tar 文件以保持目录结构完整并根据上次修改日期排除某些文件 - how do I create tar file keeping directory structure intact and excluding some files based on the last modified date 按 Linux 中一位用户的最大大小和最后修改日期列出文件大小 - To list out file size by largest size and last modified date by one user in Linux 如何使用filemtime在所有文件的最后修改时间之前移动它们 - How use filemtime to move all files by their last modified time 如何锁定“上次修改”日期? - How to lock “last modified” date? Linux - 有没有办法获取目录的文件大小,但只包括最后修改/创建日期为 x 的文件? - Linux - is there a way to get the file size of a directory BUT only including the files that have a last modified / creation date of x? 找出git中所有修改文件的最后修改时间 - finding out the last modified time of all modified files in git 如何按上次更新日期列出父目录,包括该文件夹的所有文件 - How to list parent directories by last updated date inclusive of all that folder's files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM