The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
disk space kingsto88 Filesystems, Disks and Memory 3 12-06-2006 05:28 AM
Disk space? jbarbuto SUN Solaris 4 08-18-2004 08:58 AM
available disk space on disk device??? alan UNIX for Dummies Questions & Answers 4 01-02-2004 03:06 AM
Disk Space - Docboyeee Filesystems, Disks and Memory 2 08-22-2002 12:46 PM
Out of disk space? alfabetman UNIX for Dummies Questions & Answers 4 10-03-2001 04:57 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-17-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
need help in disk space commands

hy i have written a K-shell script that will calculate the number of Disk space used by all the directories under the HOMe dir

#!/bin/ksh

cd /ednpdtu3/u01/pipe

count=`ls -ltr | grep ^d | wc -l`
echo "$count Dir found in HOME DIR"

a1=1
while [ $a1 -le $count ]
do
b=`ls -ltr | grep ^d | head -$a1 | tail -1 | tr -s " " | cut -d " " -f9`
#echo $b
a1=`expr $a1 + 1`
a2=`du -m $b`
echo "The size of $b is $a2"

done
----------------------------------------------------------------------

My home Dir contains 21 Dir. how u get those directories space utilised in MB.

here in my script du -m is not giving proper results

I have a dir called AMIS_Scripts whose total size in MB is 4497.44

but my script is giving results as

The size of AMIS_Scripts is
27.46 AMIS_Scripts/Oncor_exc_miss_rep
4469.52 AMIS_Scripts/temp
4497.44 AMIS_Scripts MB

I dnt want the result of Sub-dir inside AMIS_Scripts to show up, just want the total disk space used in MB by AMIS_SCRIPTS dir to show up in my output

Plz help me in this

Last edited by ali560045; 09-17-2008 at 03:08 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0