<?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: Perl script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051846#M719110</link>
    <description>use File::Find;&lt;BR /&gt;&lt;BR /&gt;my $base = $ARGV[0] || "./";&lt;BR /&gt;my $total = 0;&lt;BR /&gt;&lt;BR /&gt;sub addsize {&lt;BR /&gt; $total += -s;&lt;BR /&gt;}&lt;BR /&gt;find(\&amp;amp;addsize, $base);&lt;BR /&gt;&lt;BR /&gt;print "$total\n";&lt;BR /&gt;</description>
    <pubDate>Tue, 19 Aug 2003 15:20:36 GMT</pubDate>
    <dc:creator>Brian Bergstrand</dc:creator>
    <dc:date>2003-08-19T15:20:36Z</dc:date>
    <item>
      <title>Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051836#M719100</link>
      <description>Could anybody send me a Perl-script for&lt;BR /&gt;encounting the sum of all files in&lt;BR /&gt;a directory /including files in subdirectories/, in bytes? &lt;BR /&gt;High points-level!!</description>
      <pubDate>Tue, 19 Aug 2003 13:26:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051836#M719100</guid>
      <dc:creator>Stanimir</dc:creator>
      <dc:date>2003-08-19T13:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051837#M719101</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Yes, but how about:&lt;BR /&gt;&lt;BR /&gt;du -sk&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Aug 2003 13:29:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051837#M719101</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-08-19T13:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051838#M719102</link>
      <description>How about awk ?&lt;BR /&gt;&lt;BR /&gt; find . -depth -exec ll {} \; | grep -v  -e total -e drwx | awk '{datotal&lt;BR /&gt;+=$5;}END {print datotal}'&lt;BR /&gt;&lt;BR /&gt;Or if you want to break it into two nicer steps:&lt;BR /&gt;&lt;BR /&gt;find . -depth -exec ll {} \; | grep -v  -e total -e drwx &amp;gt; useme&lt;BR /&gt;&lt;BR /&gt;awk '{datotal+=$5;}END {print datotal}' &amp;lt; useme&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Aug 2003 13:33:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051838#M719102</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2003-08-19T13:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051839#M719103</link>
      <description>JS,&lt;BR /&gt;  I think du -s will do.  du -sk will give in 1024 byte blocks.&lt;BR /&gt;  Do you really need a perl script for this.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Umapathy&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Aug 2003 13:37:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051839#M719103</guid>
      <dc:creator>Umapathy S</dc:creator>
      <dc:date>2003-08-19T13:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051840#M719104</link>
      <description>run a find + ll command (e.g. find . | xargs -l20 ll ) and pipe into the following script :&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;# llsum_size : sum file size for ll result (file or stdin)&lt;BR /&gt;#&lt;BR /&gt;# usage : llsumsize [ filename ]&lt;BR /&gt;#       filename : output of the 'll' command&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;BEGIN{ total=0; countfile=0; }&lt;BR /&gt;{&lt;BR /&gt;  if(substr($1,1,1)=="-") {&lt;BR /&gt;        total+=$5;&lt;BR /&gt;        countfile++;&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;END{ totalmb= total / (1024 * 1024 );&lt;BR /&gt;  printf("llsumsize : nbfiles counted =  %d\n",countfile);&lt;BR /&gt;  printf("llsumsize : total (bytes)   =  %12d\n",total);&lt;BR /&gt;  printf("llsumsize : total (Mbytes)  =  %12.2f\n",totalmb);&lt;BR /&gt;} ' $1&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;JL</description>
      <pubDate>Tue, 19 Aug 2003 13:37:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051840#M719104</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2003-08-19T13:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051841#M719105</link>
      <description>I know you want Perl, but as John already mentioned df already does this.&lt;BR /&gt;&lt;BR /&gt;For bytes though, you'd want. du -ks will give the output in kilobytes. du -s will output the number of 512 byte blocks.&lt;BR /&gt;&lt;BR /&gt;cd $MYDIR&lt;BR /&gt;echo $(( $(du -s . | cut -f1) * 512 ))&lt;BR /&gt;&lt;BR /&gt;HTH.</description>
      <pubDate>Tue, 19 Aug 2003 13:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051841#M719105</guid>
      <dc:creator>Brian Bergstrand</dc:creator>
      <dc:date>2003-08-19T13:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051842#M719106</link>
      <description>Thanks,Gays!!!&lt;BR /&gt;I know HPUX-command "du". :))&lt;BR /&gt;But I want exactly Perl-script !!!&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Aug 2003 13:41:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051842#M719106</guid>
      <dc:creator>Stanimir</dc:creator>
      <dc:date>2003-08-19T13:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051843#M719107</link>
      <description>This is a very easy script in Perl but it does you no favor to post it. The quest is the learning of Perl itself. If you do a man of File::Find, you should really have everything you need to get started. &lt;BR /&gt;</description>
      <pubDate>Tue, 19 Aug 2003 14:01:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051843#M719107</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-08-19T14:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051844#M719108</link>
      <description>:)&lt;BR /&gt;#!/usr/bin/perl -w&lt;BR /&gt;system("du -sk");&lt;BR /&gt;&lt;BR /&gt;Regards, &lt;BR /&gt;Sergejs</description>
      <pubDate>Tue, 19 Aug 2003 14:20:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051844#M719108</guid>
      <dc:creator>Sergejs Svitnevs</dc:creator>
      <dc:date>2003-08-19T14:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051845#M719109</link>
      <description>version nr. 2&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/perl -w&lt;BR /&gt;my $path="/home/";&lt;BR /&gt;print "\n\nThe sum of all files in a directory '$path' (including files in subdirectories) is ", &amp;amp;Sizes ($path), " bytes \n";&lt;BR /&gt;sub Sizes {&lt;BR /&gt;  my $dir = shift;&lt;BR /&gt;  my $size = 0;&lt;BR /&gt;  my $entry;&lt;BR /&gt;  my @subDirs;&lt;BR /&gt;  chdir $dir or die " chdir failed ($!)\n";&lt;BR /&gt;  opendir DIR, "." or die " opendir failed ($!) \n";&lt;BR /&gt;  while (defined ($entry = readdir DIR)) {&lt;BR /&gt;    if (-f $entry) {&lt;BR /&gt;      $size += -s _;&lt;BR /&gt;    }&lt;BR /&gt;    elsif (-d _ and $entry ne '.' and $entry ne '..') {&lt;BR /&gt;      $size += -s _;&lt;BR /&gt;      push @subDirs, $entry;&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;  closedir DIR or die " closedir failed ($!)\n";&lt;BR /&gt;  foreach $dir (@subDirs) {&lt;BR /&gt;    $size += &amp;amp;Sizes ($dir);&lt;BR /&gt;  }&lt;BR /&gt;  chdir '..' or die " chdir .. failed ($!)\n";&lt;BR /&gt;  return $size;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards, &lt;BR /&gt;Sergejs</description>
      <pubDate>Tue, 19 Aug 2003 14:59:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051845#M719109</guid>
      <dc:creator>Sergejs Svitnevs</dc:creator>
      <dc:date>2003-08-19T14:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051846#M719110</link>
      <description>use File::Find;&lt;BR /&gt;&lt;BR /&gt;my $base = $ARGV[0] || "./";&lt;BR /&gt;my $total = 0;&lt;BR /&gt;&lt;BR /&gt;sub addsize {&lt;BR /&gt; $total += -s;&lt;BR /&gt;}&lt;BR /&gt;find(\&amp;amp;addsize, $base);&lt;BR /&gt;&lt;BR /&gt;print "$total\n";&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Aug 2003 15:20:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051846#M719110</guid>
      <dc:creator>Brian Bergstrand</dc:creator>
      <dc:date>2003-08-19T15:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051847#M719111</link>
      <description># perl -MFile::Find -le'find(sub{-f and$s+=-s},".");END{print$s}'&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Tue, 19 Aug 2003 16:25:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script/m-p/3051847#M719111</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-08-19T16:25:54Z</dc:date>
    </item>
  </channel>
</rss>

