Hi all

I have written the script below (with a great help from Browser_UK and other holly brethren here),...
The script works well, but I have been teased by colleges in other branch that they can perform the same operation manually and much faster. Basically, the script obtains the size, number of files and folders of a given path. However if more than one path is supplied then the script will obtain the information of one path and then moves to the second path and so on. Where as manually this operation can be done simultaneously - i.e. right clicking on a selected folder then properties and repeating this process on as many folders as you can fit on the screen. My question is, can this be achieved in Perl script? Can I instruct Perl in my script to obtain the information on the two folder paths that I have supplied simultaneously? And is this what's known as Forking? I am not sure on where to start to look into the possibilities on getting my script to "multi-task" if it’s the correct way of putting it. And as ever your Perls of wisdom are highly appreciated. Any improvements and modifications - to conserve memory are most welcome.

Many Thanks

Btw : In a nut shell - I am migration and getting rid of every M$ server we have here - so it’s a holly operation for me - and migrating all user / data shares and application data to a SAN/NAS environment, using Linux datamovers, that attaches EMC SAN/NAS (disks are housed in Symmetric and the fibre channels patched on the Connectrix - DART is used to move the data). Netbios names will be created for the server that I am getting rid off and using EMC tools for moving huge amounts of data. If anyone has done something similar to this (I was informed this project has only been done in the US) then your comment will also be highly appreciated.
AUTOLOAD; require 5.006; $|++; use strict; use warnings 'all'; #use diagnostics; use Win32::OLE qw[in]; use vars qw/@LoH/; for my $Path (@ARGV) { my $Match = {}; my $fso= Win32::OLE->new( 'Scripting.FileSystemObject' ); my @folders = $fso->GetFolder( $Path || die"No 'TargetPath' was fo +und\n" ); my $fss = $fso->GetFolder($Path); $Match->{path} = $Path; my $Size = $fss->size( ); $Match->{size} = $Size ; my ($fCount, $sCount) = (0,0); print "\nPlease Wait"; while( @folders ) { print "."; my $folder = pop @folders; $fCount += $folder->Files->Count; $sCount += $folder->SubFolders->Count; for my $subFolder ( in $folder->SubFolders ) { $fCount += $subFolder->Files->Count; push @folders, $_ for in $subFolder->SubFolders ; $sCount += $subFolder->SubFolders->Count; } } $Match->{files} = $fCount; $Match->{folders} = $sCount; print "\n\n\nSize of $Path = $Size byte\n\nFiles : $fCount, Folde +rs : $sCount\n\n"; push @LoH, $Match; } # From this point and below I am checking if the two paths match - so +migration is successfull. exit() if ($#LoH < 1); if ($LoH[0]->{size} == $LoH[1]->{size} && $LoH[0]->{files} == $LoH[1]- +>{files} && $LoH[0]->{folders} == $LoH[1]->{folders}) { print "\n[ MATCH ]\n"; } else { print "\nNOT MATCHED\n" }
Cheers.

In reply to Getting a script to do 2 process simultaneously. 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.