I'm trying to write a script to summarise a bunch of folders. So I have the following structure:
monitor/abc_123 1G
monitor/abc_213 1G
monitor/abc_111 2G
monitor/bbc_123 2.5G
What I need is to issue a command (using du I presume) to summarise the directories prefixed with "abc_"
I've tried the following:
du -sh abc*
... but this just gives me a summary for each folder. I need the script to generate the total size of all three directories in this example.
Thanks in advance
How about
du -ch abc_* | tail -n 1
That should produce a grand total.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.