How can I adapt this bit of code;
my $size = 0; $size += (-f $_ ? -s _ : 0) for (<*>); print $size;
so that instead of <*> i can pass on a remote share or directory name?

like this: \\Server\Share_Name or \\Server\DriveLetter\FolderName.

Since I have not tried this code yet so I don't know how fast it is, but I have tried these 2 methods

1) ($Total)=( (qx{dir /s "$UncSharePath"})[-2]=~ /([\d,]+) bytes/ ) 2) find(sub { $total += -s }, $dir);
And they are very slow -unusable really in real life, ok on small servers thu.
Does any one know how can I extract the sizes of a remote share or folder directly off the OS? Surely automating this process in Perl should be faster than doing it manually, i.e. by right clicking on a folder and selecting the properties, which seems to be the fastest method, but unfortunaly I have a list of servers to go through...
Thanks for your help Guys.

In reply to Faster way to obtain a remote share or folder size by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.