假设有一个图像存储目录,例如,./photos/john_doe,其中有多个子目录,许多特定文件驻留在其中(例如,*.jpg)。如何计算john_doe分支下这些文件的摘要大小?
./photos/john_doe
*.jpg
john_doe
我试过du -hs ./photos/john_doe/*/*.jpg,但这仅显示单个文件。此外,这仅跟踪john_doe目录的第一个嵌套级别,例如john_doe/june/,但会跳过john_doe/june/outrageous/。
du -hs ./photos/john_doe/*/*.jpg
john_doe/june/
john_doe/june/outrageous/
那么,我如何遍历整个分支,总结某些文件的大小?
size directory directory-structure files
directory ×1
directory-structure ×1
files ×1
size ×1