PDA

View Full Version : take a look at this



shishir_knit
April 14th, 2009, 04:59 PM
array=('ls -B')
i=0
while [ $i -lt $nof ]; do
p=`${array[$i]}`
q="$p"
n=`du -b -s $q`
echo "$n">>/home/shishir/read.txt
let i++
done

this code is not running properly
what to do

reply will be appreciated

Tony Flury
April 14th, 2009, 05:07 PM
Can you tell us what it is meant to do ? Do you get error messages ?

shishir_knit
April 14th, 2009, 05:14 PM
i wanted to get the total size of directory/file without their subdirectory sizes
this command
`du -b -s $q`
is not working when filename contains space

shishir_knit
April 14th, 2009, 05:17 PM
here nof is number of files/directories in current directory

Perfect Storm
April 14th, 2009, 06:22 PM
Moved to Programming Talk, you might get a better respond here.

shishir_knit
April 14th, 2009, 07:03 PM
thanks

sujoy
April 14th, 2009, 07:16 PM
du -bsS * > filename
seems to do the job pretty fine, not sure what more you need though

shishir_knit
April 14th, 2009, 07:44 PM
this code too is not working as i want
the common problem with this code and my code is that it shows the size of many directories as 4096 which actually is not

secondly i dont want temporary files(*.*~)in the list
i want the sizes of only files & directories(no need of internal details of subdirectories or files)

shishir_knit
April 15th, 2009, 04:17 PM
please reply