Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
1  
What if ls | grep -v "_edit" | xargs du -sin the root folder? –  skwllsp Nov 28 '13 at 6:48

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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