<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculating file usage in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876947#M99896</link>
    <description>You could try&lt;BR /&gt;&lt;BR /&gt;TOTAL=`awk '{print (s+=$5/1073741824}' $FILENAME | tail -1&lt;BR /&gt;&lt;BR /&gt;A bit shorter if nothing else.&lt;BR /&gt;(the 1073741824 is 1024*1024*1024)&lt;BR /&gt;&lt;BR /&gt;Chris</description>
    <pubDate>Wed, 08 Jan 2003 12:20:18 GMT</pubDate>
    <dc:creator>Chris Wilshaw</dc:creator>
    <dc:date>2003-01-08T12:20:18Z</dc:date>
    <item>
      <title>Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876946#M99895</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt;I'm currently on a project to migrate an old K-class server to an NT box (I know - I wasn't impressed either). One of the filesystems is 117GB in size and I have been asked to get all files over 6months old, calculate how much space they all take up and then do it on a per user basis.&lt;BR /&gt;&lt;BR /&gt;I have done a find /myfs -mtime +168 -exec ll {} \; &amp;gt; list. &lt;BR /&gt;&lt;BR /&gt;What I wanted to do was add each of the size fields together ($5) which i attempted in a 'for' loop this has worked but tells me I can get rid of 88GB! This may be true but I want to check whether my figures are correct and also get suggestions on an easier/better way of doing this. Advice would also be appreciated for getting the amount each individual user is using.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;&lt;BR /&gt;Ton</description>
      <pubDate>Wed, 08 Jan 2003 12:05:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876946#M99895</guid>
      <dc:creator>Tony Walker</dc:creator>
      <dc:date>2003-01-08T12:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876947#M99896</link>
      <description>You could try&lt;BR /&gt;&lt;BR /&gt;TOTAL=`awk '{print (s+=$5/1073741824}' $FILENAME | tail -1&lt;BR /&gt;&lt;BR /&gt;A bit shorter if nothing else.&lt;BR /&gt;(the 1073741824 is 1024*1024*1024)&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 08 Jan 2003 12:20:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876947#M99896</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-01-08T12:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876948#M99897</link>
      <description>Ton,&lt;BR /&gt;&lt;BR /&gt;I ran a quick test and it came up with 5 when my manual calculations came up with 5.9 GB.  I think I'd save the division for the end - it looks like it's rounding.  In other words, eliminate the &lt;BR /&gt;(( i = (i / 1024) /1024)) line&lt;BR /&gt;and divide by 1024 again in the &lt;BR /&gt;GB=$(expr $TOTAL / 1024) line.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 08 Jan 2003 12:23:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876948#M99897</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-01-08T12:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876949#M99898</link>
      <description>Hi Ton,&lt;BR /&gt;&lt;BR /&gt;Try find /myfs -type f -atime +168 -exec du -k {} \; &amp;gt; list&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jerome</description>
      <pubDate>Wed, 08 Jan 2003 12:26:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876949#M99898</guid>
      <dc:creator>Jerome Baron</dc:creator>
      <dc:date>2003-01-08T12:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876950#M99899</link>
      <description>That's the problem with using expr.&lt;BR /&gt;&lt;BR /&gt;It only deals in integers.&lt;BR /&gt;&lt;BR /&gt;expr 10 / 3&lt;BR /&gt;3</description>
      <pubDate>Wed, 08 Jan 2003 12:26:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876950#M99899</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-01-08T12:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876951#M99900</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try this script:&lt;BR /&gt;&lt;BR /&gt;TOTAL=0&lt;BR /&gt;SIZES=`find /myfs -mtime +168 -exec ll {} \;|awk '{ print $5 }'`&lt;BR /&gt;for SIZE in SIZES&lt;BR /&gt;do&lt;BR /&gt;  TOTAL=`expr $TOTAL + $SIZE`&lt;BR /&gt;done&lt;BR /&gt;echo "Total Size: $TOTAL Bytes"&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Wed, 08 Jan 2003 13:04:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876951#M99900</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2003-01-08T13:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876952#M99901</link>
      <description>Pete, I tried this approach originaly but after adding about 7 large numbers together it started producin negative numbers!? Thats why I did the Mb conversion before the addition. I'm assuming that it is working correctly and that my logic is sound? Good point with the exec du -k {}\; - I'll give that a go....&lt;BR /&gt;&lt;BR /&gt;Any thoughts on calculating it per user? This is what I have so far but it seems to product differing results (e.g 5user in a row have the same space then 1 has 17GB!?)&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Tony</description>
      <pubDate>Wed, 08 Jan 2003 13:22:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876952#M99901</guid>
      <dc:creator>Tony Walker</dc:creator>
      <dc:date>2003-01-08T13:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876953#M99902</link>
      <description>Ton,&lt;BR /&gt;&lt;BR /&gt;Here's a VERY simple "perl" program:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;$SYMBOLS=" KMGTP";&lt;BR /&gt;$totarr="";&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;tr/  / /s;&lt;BR /&gt;($tmp1,$tmp2,$username,$grpname,$filesize,$tmp3) = split(/ /);&lt;BR /&gt;if ($username ne "") {&lt;BR /&gt;$totarr{$username} += $filesize;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;foreach $username (sort keys %totarr) {&lt;BR /&gt;$filesizes=$totarr{$username};&lt;BR /&gt;$spaceinuse=0;&lt;BR /&gt;$spacesymbol="";&lt;BR /&gt;for ($i=0;$i &amp;lt; 6;$i++) {&lt;BR /&gt;if ($filesizes &amp;gt;= (1024**$i)) {&lt;BR /&gt;$spaceinuse=$filesizes/(1024**$i);&lt;BR /&gt;$spacesymbol=substr($SYMBOLS,$i,1);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;printf("%9s %15.3f %sB, bytes is %s\n",$username,$spaceinuse,$spacesymbol,$totar&lt;BR /&gt;r{$username});&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;To use it, do something like this:&lt;BR /&gt;&lt;BR /&gt;perlprogram.pl &amp;lt; yourfilelist&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 08 Jan 2003 17:49:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876953#M99902</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2003-01-08T17:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876954#M99903</link>
      <description>I attached a commented and indented version&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 08 Jan 2003 18:07:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876954#M99903</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2003-01-08T18:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876955#M99904</link>
      <description>Harry,&lt;BR /&gt;&lt;BR /&gt;Thanks for that - a good platform for me to start learning perl. I look forward to when I can call that VERY simple :) Thanks to everyone for your responses.&lt;BR /&gt;&lt;BR /&gt;cheers,&lt;BR /&gt;&lt;BR /&gt;Tony</description>
      <pubDate>Thu, 09 Jan 2003 11:35:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876955#M99904</guid>
      <dc:creator>Tony Walker</dc:creator>
      <dc:date>2003-01-09T11:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating file usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876956#M99905</link>
      <description>Harry,&lt;BR /&gt;&lt;BR /&gt;With my limited Perl knowledge I set about editing your script so that it would just produce the total amount of space taken up by all the files. The result is 152GB which I know cannot be right! Could you point me in the right direction?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Tony</description>
      <pubDate>Thu, 09 Jan 2003 11:58:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculating-file-usage/m-p/2876956#M99905</guid>
      <dc:creator>Tony Walker</dc:creator>
      <dc:date>2003-01-09T11:58:25Z</dc:date>
    </item>
  </channel>
</rss>

