Results 1 to 3 of 3
Hi All,
I have a directory which is extremely large and I would like to exclude this directory while doing a "du"
I tried the following ..
du -ks --exclude="DIR_PATTERN" ...
- 02-06-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
Excluding a directory from "du" command
Hi All,
I have a directory which is extremely large and I would like to exclude this directory while doing a "du"
I tried the following ..
du -ks --exclude="DIR_PATTERN" *
- This works if the size of the directory is small ..
- However, if the size is extremely large, it still tries to calculate the size, before excluding from the output, and this takes forever.
Q: How do I exclude a directory from du?
OS is RHEL 3.0 Update9
- RHEL noob
- 02-07-2009 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
welcome to the forum
trying "du --exclude=pix" I got a listing that excluded that directory.
it is 27gigs. Why you need -k" I'm not sure: it's the default.the sun is new every day (heraclitus)
- 02-08-2009 #3Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
the directory resides on a NAS filer and is probably greater than 50G in size ..
though we mention an exclude list, the du is still trying to calculate the size .. and then excludes from the display ..
I got the following recommendation from one of my colleagues .. I still haven't tested it yet ..
---------------------------------------------
#ls -F|grep />/tmp/l2
#vi /tmp/l2 (remove the directory you have to exclude)
#for i in `cat /tmp/l2`
do
du -hs $i > /var/tmp/du_lisiting.out
done
---------------------------------------------


Reply With Quote