4

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
  • 1
    What if ls | grep -v "_edit" | xargs du -sin the root folder?
    – user17530
    Commented Nov 28, 2013 at 6:48

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .