0

i want to find the total space used for the files owned by me from my current directory.

i have

du -sh `find ./ -user $USER -type f`

which gives

8.0K    ./.a
8.0K    ./t
4.0K    ./cat/A
4.0K    ./a

using -s has no effect.

using du -sh by itself includes the space for files not owned by me and also includes space used by folders themselves.

I want to be able to add all of the above and displayed in readable format automatically.

At this stage i am happy to include the space used for folders or not, doesnt matter.

Any tips would be appreciated.

Edited by mossman mudas

2
Contributors
2
Replies
11
Views
4 Years
Discussion Span
Last Post by mossman mudas
0

hi,

from du --help :

-s, --summarize display only a total **for each argument**

so, as each given filename is an argument...

find's -printf can print files size.
you could use bash to sum files size like this:

echo $(( $(find . -type f -user $USER -printf '+%s') ))"
1

thanks Watael.

after looking at help i saw -c then used a pipe.

du -ch find ./ -user $USER -type f | tail -n 1

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.