目录中所有文件内容的总大小 [英] Total size of the contents of all the files in a directory

查看:81
本文介绍了目录中所有文件内容的总大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用lsdu时,我将获得每个文件占用的磁盘空间量.

When I use ls or du, I get the amount of disk space each file is occupying.

我需要打开每个文件并计算字节数后得到的文件和子目录中所有数据的总和.如果我能在不打开每个文件也不计数的情况下获得此奖励积分.

I need the sum total of all the data in files and subdirectories I would get if I opened each file and counted the bytes. Bonus points if I can get this without opening each file and counting.

推荐答案

如果要表观大小"(即每个文件中的字节数),而不是磁盘上文件占用的大小,请使用-b--bytes选项(如果您的Linux系统具有GNU coreutils ):

If you want the 'apparent size' (that is the number of bytes in each file), not size taken up by files on the disk, use the -b or --bytes option (if you got a Linux system with GNU coreutils):

% du -sbh <directory>

这篇关于目录中所有文件内容的总大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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