How can I get the directory size in Unix?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How can I get the directory size in Unix?
# 1  
Old 02-28-2001
Hi,everyone,

Can I use UNIX command to get a directory size in UNIX ?

I am developing a software using C in UNIX. How can I get the directory size?

Thanks

Harry
# 2  
Old 03-01-2001
du

lists how much disk space is used by a file or a directory(as well as subdirectory)in 1K blocks(default).

man du for more info

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX commands to display the biggest file by size in a directory

Hello guys, Please i need to know the biggest files in my directory let's say$ >du -h | egrep 'M|G|G' 195M ./TMP 3.6M ./TP_DEC2012 146G . But here the result it's giving me the biggest directory in the path. Actually i want to know the biggest file in 146G . Can anyone... (6 Replies)
Discussion started by: gillesi
6 Replies

2. 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

3. Shell Programming and Scripting

How to compare if the size of the directory is more than 500MB in unix

I use du -sk command to find the size of the directory but when i use the result of 'du -sk' into if statement its throwing error.. Could u solve with this..? (14 Replies)
Discussion started by: shaal89
14 Replies

4. 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

5. UNIX for Dummies Questions & Answers

directory size in unix

hi everyone my q is that i want to know what 's the reason behind the direcotry size in unix like if i do ls -ltr in my home directory it will list all the files and directory .. then the size of directory is either 512 or 1024 .. and every directory is containing files in... (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

6. UNIX for Dummies Questions & Answers

directory tree with directory size

find . -type d -print 2>/dev/null|awk '!/\.$/ {for (i=1;i<NF;i++){d=length($i);if ( d < 5 && i != 1 )d=5;printf("%"d"s","|")}print "---"$NF}' FS='/' Can someone explain how this works..?? How can i add directory size to be listed in the above command's output..?? (1 Reply)
Discussion started by: vikram3.r
1 Replies

7. 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

8. Shell Programming and Scripting

size of directory

Hello again; I have a directories and subdirectories in my current directory and i wanna to find the directories( and subdirectories ) which are larger than what user enters as first parameter. find . -type d -size +"$1"c -print > directories.dat I used this command and i am not sure it is... (19 Replies)
Discussion started by: redbeard_06
19 Replies

9. UNIX for Advanced & Expert Users

largest size directory in unix

I want to find the which directory under a directory occupy the maximum size is there is any command to find please help (5 Replies)
Discussion started by: arunkumar_mca
5 Replies

10. UNIX for Dummies Questions & Answers

size of a directory?

hi, say i have the following directory structure a/b/c/d... can i do df -kt /a/b/c/d and the output will gives me the total space of the directory space in d? or the output will just be the total space of the parent directory a. hope its clear.. (2 Replies)
Discussion started by: yls177
2 Replies
Login or Register to Ask a Question