获取目录的大小并排除一些文件夹

opH*_*AME 3 command-line shell disk-usage

我有一个这样的目录结构:

  1. 申请1
  2. application1_edit
  3. 申请2
  4. application2_edit

有没有办法获得每个文件夹(包括子目录)的总大小并排除所有具有_edit名称的文件夹?

我试过du -s根文件夹,但它列出了所有子目录。

slm*_*slm 5

像这样的事情应该这样做。

$ du -s application[12]
Run Code Online (Sandbox Code Playgroud)

例子

$ ls -l
total 16
drwxrwxr-x 2 saml saml 4096 Nov 28 01:51 application1
drwxrwxr-x 2 saml saml 4096 Nov 28 01:51 application1_edit
drwxrwxr-x 2 saml saml 4096 Nov 28 01:51 application2
drwxrwxr-x 2 saml saml 4096 Nov 28 01:51 application2_edit
Run Code Online (Sandbox Code Playgroud)

磁盘使用情况:

$ du -s application[12]
4   application1
4   application2
Run Code Online (Sandbox Code Playgroud)