Find the total size of all directories that are owned by a particular User


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find the total size of all directories that are owned by a particular User
# 1  
Old 03-07-2011
Find the total size of all directories that are owned by a particular User

Hi All,

I am writing a script in which i need find the total size of all the directories that are present in a directory which are owned by a particular user.

I will explain in details
i have a dir DIR1 in which i have 5 dir's DIRA DIRB DIRC DIRD DIRE.
DIRA DIRC DIRE are owned by "eswar" i need to find total size of all the three directories.

Thank you all,
Firestar.
# 2  
Old 03-07-2011
Part of the answer: du -s DIRA DIRC DIRE | awk '{ T+=$1; } END { print T/2, "KB" }'

What is your system? What is your shell?
# 3  
Old 03-07-2011
Hi firestar,

Please try with:

Code:
owner=$(ls -l | awk '$1~/^d/ && $3~/eswar/{print $8}')
for i in $owner;
do du -sh $i;
done

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Find the total size of multiple files

If I have a number of files in a directory, for example, test.1 test.2 test.3 abc.1 abc.2 abc.3 and I need to find the total file size of all of the test.* files, I can use du -bc test.* in Linux. However, in Solaris, du does not have the -c option. What can I do in Solaris to get... (11 Replies)
Discussion started by: learnix
11 Replies

2. Shell Programming and Scripting

Find a particular directory in multiple file systems and calculate total size

Hello : I need some help in writing a ksh script which will find a particular directory in all the file systems in a server and finally report the total size of the direcotry in all the file systems. Some thing like this.. find /u*/app/oracle -type d -name "product" -prune and then... (1 Reply)
Discussion started by: Sam1974
1 Replies

3. AIX

find command to list all the 777 files and directories owned by root user

Hi I'm logged in to an AIX box now and we need to do an audit on this box. cbssapr01:# pwd / Which command will show all the files and directories owned by root user with permissions as 777 ? (8 Replies)
Discussion started by: newtoaixos
8 Replies

4. UNIX for Dummies Questions & Answers

find directories owned by a given user

Hi, I want to know if the is a way I can list the directories owned by a given user. Say i am logged in as that user. I found out the find command lists the files owned by a certain user/group but i want to know only the directories and if possible the permissions associated with these... (6 Replies)
Discussion started by: poojabhat
6 Replies

5. Shell Programming and Scripting

to find the size of directories

Hi, how to know the size of the files in the directory, exclusing the subfolder. ? i tried du -h du -sk du -k but its not giving.. (2 Replies)
Discussion started by: mail2sant
2 Replies

6. UNIX for Dummies Questions & Answers

How to find out in which directories a user can write?

Hi everybody, what command can show me the directories in which a certain user can write to? Kind Regards FranzB (2 Replies)
Discussion started by: FranzB
2 Replies

7. Solaris

Solaris 10 - How to find the total size of my hard disk?

Friends, I have an 80 GB HDD, but I wish to know if there is a direct command in Solaris 10 to find out the size of my hard disk (similar to fdisk -l in Linux). Thank you saagar (3 Replies)
Discussion started by: saagar
3 Replies

8. UNIX for Dummies Questions & Answers

Find total size for some files?

Hi, I'm newbie to Unix. I'd like to count the total size of those files in my directory by date. For example, files on this period 05/01/08 - 05/31/08. If possible can we count by byte instead of kb. if I use $ du - ks , it will add up all files in the dir. thanks, Helen (5 Replies)
Discussion started by: helen008
5 Replies

9. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

10. Filesystems, Disks and Memory

How to find the total size of a dirctory tree in Solaris

Hi, I want to find the total size of some directory trees in my solaris 9 machine. Is there a command or utility I can use to do it. Please let me know if there is any way. Thanks Akheel (1 Reply)
Discussion started by: 0ktalmagik
1 Replies
Login or Register to Ask a Question