[SlugBug] Listing subdirectories only
Craig Andrews
craig at simplyspiffing.com
Mon Jan 9 11:50:33 GMT 2006
Alan Dawson wrote:
> How do you list subdirectories only ..
You can non-recursively list just the directories in the current
directory like this:
find . -type d -maxdepth 1
> I'm trying to find where all the data is on a users home folder
>
> for i in `ls -1`; do du -shm $i ; done | sort -gr
>
> but it coughs on files obviously
So:
find . -type d -maxdepth 1 | xargs -l1 du -sm | sort -gr
works for me - files are only included if you tell it to. Remember not
to use the -h option to du, or the sort will fail due to the
'humanisation' of the output.
Note: on NetBSD 2.2, the -l option to xargs doesn't work, and neither
does the -g option to sort. If any options are moaned about, then adjust
to suit.
Thanks,
--
C
More information about the SlugBug
mailing list