how to find the size of a directory alone


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to find the size of a directory alone
# 1  
Old 10-01-2008
Java how to find the size of a directory alone

hi,
i am using korn shell...............
Any one please help me in solving the below question:

question: i need to find the size of the directory alone...

let us assume /root/kamal/hash1 is the directory, now i want to find the hash1 size ..

I tried below command but it is giving the size of all files in the folder..
ls -l /root/kamal/hash1 | awk '{print $5}'

i need to find size of hash1 alone.....

please help me in soving this ..

thanks in advance.....
kamal.
# 2  
Old 10-01-2008
Code:
du -s /root/kamal/hash1

If you want it in human readable form..
du -hs /root/kamal/hash1

# 3  
Old 10-01-2008
Quote:
Originally Posted by nua7
Code:
du -s /root/kamal/hash1

If you want it in human readable form..
du -hs /root/kamal/hash1

the ooutput for your command is: 24K /root/kamal/hash1
but i want it to be display only size in bytes ...
like this o/p i required... : 4096
that is sufficient for me....
pls help me
# 4  
Old 10-01-2008
Code:
du -bs /root/kamal/hash1

# 5  
Old 10-01-2008
Quote:
Originally Posted by nua7
Code:
du -bs /root/kamal/hash1

can u please specify other way without using "du"
# 6  
Old 10-01-2008
Is this a homework question..?
# 7  
Old 10-01-2008
in your awk command, add up column 5.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 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. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Discussion started by: shaal89
0 Replies

4. Shell Programming and Scripting

Find which dir is big size in a directory

Hi all, Could you please tellme the commadn which sorts the list of directories in a parent dir by their size. Thanks. (2 Replies)
Discussion started by: firestar
2 Replies

5. Shell Programming and Scripting

find size, cp breaks directory structure

I'm using this now: find /some/path/with/sourcefiles -type f -size -7M -exec /bin/cp -uv {} /some/path/ \; but it doesn't preserve the directory structure, also I've tried it with find /some/path/with/sourcefiles -type f -size -7M -exec /usr/bin/rsync -auv {} /some/path/ \; but that doesn't... (9 Replies)
Discussion started by: unclecameron
9 Replies

6. Solaris

Directory size larger than file system size?

Hi, We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB? I have seen this before we an Oracle temp file... (6 Replies)
Discussion started by: sparcman
6 Replies

7. Shell Programming and Scripting

find with file size and show the size

Hi All... is the below command be modified in sucha way that i can get the file size along with the name and path of the file the below command only gives me the file location which are more than 100000k...but I want the exact size of the file also.. find / -name "*.*" -size +100000k ... (3 Replies)
Discussion started by: rpraharaj84
3 Replies

8. Shell Programming and Scripting

Find the size of a directory

Hi, I would really appreciate if you could help me with this. I have a directory structure like this :- /data Under data i have directories /data1 , /input_files , /output_files etc . Under these directories I have other subdirectories. What i am looking for is to find out the size of all... (5 Replies)
Discussion started by: divz
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. HP-UX

How find size of directory

Hi, How can find the size of the directory. If the directory has 1000 files. I want the total size of directory including all the files. the bdf command is just able to give only the volume size. It is not heling my cause. (2 Replies)
Discussion started by: truth
2 Replies
Login or Register to Ask a Question