3

I have an directory structure like this:

  1. application1
  2. application1_edit
  3. application2
  4. application2_edit

Is there any way to get the total size for every folder (including sub-directories) and exclude all folders with _edit in name?

I have tried du -s on the root folder, but it lists all sub-directories.

  • 1
    What if ls | grep -v "_edit" | xargs du -sin the root folder? – Sergei Kurenkov Nov 28 '13 at 6:48
5

Something like this should do it.

$ du -s application[12]

Example

$ 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

Disk usage:

$ du -s application[12]
4   application1
4   application2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.