![](/img/trans.png)
[英]How to list files recursively with complete path, size, last accessed date and last modified date?
[英]How do I list all files with their size and last modified date?
我想以人类可读的格式大小和日期戳列出所有文件,包括子目录中的文件,并按大小对其进行排序。 目前我可以用下面的代码做到这一点:
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 &
它按大小排序,而不是按文件夹排序。 我希望它对所有文件进行排序,而不管其路径如何。 我怎么做?
关于什么 :
find . -printf '%s %p\n' | sort -h -r | head
在我的情况下输出:
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
文件大小以字节为单位。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.