如何让 find 命令打印出带有文件名的文件大小? [英] How do I get the find command to print out the file size with the file name?

查看:19
本文介绍了如何让 find 命令打印出带有文件名的文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我发出 find 命令如下:

If I issue the find command as follows:

find . -name *.ear

打印出来:

./dir1/dir2/earFile1.ear
./dir1/dir2/earFile2.ear
./dir1/dir3/earFile1.ear

我想将名称和大小打印"到命令行:

I want to 'print' the name and the size to the command line:

./dir1/dir2/earFile1.ear  5000 KB
./dir1/dir2/earFile2.ear  5400 KB
./dir1/dir3/earFile1.ear  5400 KB

推荐答案

find . -name '*.ear' -exec ls -lh {} ;

只是 jer.drab.org 回复中的 h 额外内容.节省精神上转换为 MB 的时间;)

just the h extra from jer.drab.org's reply. saves time converting to MB mentally ;)

这篇关于如何让 find 命令打印出带有文件名的文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆