Re: Feature Request: du --dir-with-slash

From:

Pádraig Brady

Subject:

Re: Feature Request: du --dir-with-slash

Date:

Thu, 6 Mar 2008 15:35:28 +0000

User-agent:

Thunderbird 2.0.0.6 (X11/20071008)

Thomas Guettler wrote:
> Hi,
>
> I use "du -ax / | sort -rn > /var/tmp/du-`date --iso`" to get the sorted
>
> Unfortunately you can't see a difference between a directory and a file
> in the output. It would be nice if the directories would be added by a
> slash.
>
> This way you can see if a line is a directory or not. This is even more
> important
> if you want to use the output for a script.
>
> I suggest 'du --dir-with-slash' or 'du --trailing-slash' as parameter.
If we were going to do that we should do it unconditionally.
I can't see how it would break existing scripts.
POSIX can't disallow that can it!
As an alternative try:
find / -xdev -printf "%k\t%p%y\n" |
sed 's/d$/\//;t; s/.$//;' |
LC_ALL=C sort -rn -k1,1
Pádraig.