How to check directory size


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to check directory size
# 1  
Old 08-29-2005
How to check directory size

how say I have directory how can I get the directory size in mega and if it less then 1 mega so byts
Thanks
# 2  
Old 08-29-2005
older versions of du don't have this as an option but you can download fileutils from say www.sunfreeware.com for solaris. I'm sure there are such sites for hp-ux etc as well..

du -h

would give you human readable.

Last edited by plimpix; 08-29-2005 at 10:25 AM.. Reason: thinking something else!
# 3  
Old 08-30-2005
More about sizes..
well it seams my su don't support su -h (its itanium machine)
is there any way to get the same result with script ? I can't install any thing new here.
one more question about getting the size of afile ..
say if ilike to get file size in houmen readable format when I sort the files with ls or ll can it be done?
thanks for the helpers
# 4  
Old 08-30-2005
regarding file size, normal ls -lrt with cut command is not helping? What do you mean by human readable format?
# 5  
Old 08-30-2005
i mean like: file x is 4 mega or file y is 300kb
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check total files size in hdfs directory?

Is there a way to calculate the total file size of HDFS file directory in GB or MB? I dont want to use du/df command. Without that is there a way HDFS Directory - /test/my_dir (1 Reply)
Discussion started by: rohit_shinez
1 Replies

2. Shell Programming and Scripting

File size check

I am trying to check whether two files are empty or not using below if condition but its checking for only one file if ] Again I tried if && ] Need your assistance (2 Replies)
Discussion started by: Aditya_001
2 Replies

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

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. Shell Programming and Scripting

Check the file size - help

I want to write a batch job (ksh) with the following requirement we have file feeds coming to our system from other team, if the file size is greater than expected then we dont need to process the file for the day and need to archive the file and send email notification to the manager saying... (5 Replies)
Discussion started by: sithara
5 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

Check for file size is zero or not.

I have following script on AIX/KSH if ] ; then echo "filename exists and is > 0 bytes" else echo "filename does not exist or is zero length" fi It is not working. What is wrong here??? (3 Replies)
Discussion started by: Hangman2
3 Replies

9. Shell Programming and Scripting

How to check if 3 files have same size in directory

I need to determine if any three files have the same file size in a specified directly? I have got as far as listing the file sizes but where to go from here? ls -al |sort -n -r +4 | awq '{print $5}' Thanks in anticipation (5 Replies)
Discussion started by: oggle
5 Replies

10. Shell Programming and Scripting

check logfile size

Hello everyone! Can anyone help me with this? I need a script that looks at a logfile and check itīs size. If itīs over a sertain size the i should get an email. Dont really know how the grep that info "the size" Please help.... (4 Replies)
Discussion started by: dozy
4 Replies
Login or Register to Ask a Question