codechuck has asked for the wisdom of the Perl Monks concerning the following question:

I use a loop to map network drives(NT) to x: on various PC's in a list, then get the space usage and find mp3's on each by using find. It only works for the first mapping unless I use a different letter. It looks like find will only run on x: once. If I dynamically increment the mapping letter it works. Maybe it needs to be reset. Maybe there's another way to do this??
sub GetSize { if (!defined($_[0])) { $_[0] = "GetSize function called, no value supplied!"; }; $TotalSize=0; find sub { if (-f) { if (/mp3/){&LogMessage("$_\n");} } $TotalSize += -s; }, $_[0]; ($TotalSize,$dis) = split(/\./,$TotalSize); &LogMessage("$TotalSize\n"); } ########

Replies are listed 'Best First'.
Re: file::find reset?
by isotope (Deacon) on May 07, 2001 at 19:52 UTC
      Yes, I use the mapping/unmapping code in another program for doing network backups using NT Backup. I want to modify that program so that I get the total disk space used by each user and the grand total so that I know who to tell to cleanup before the backup job requires a 2nd tape. It looks like find must keep something in memory, maybe a hash that it relates to X: which interferes when X: is moved. This will make a nice program when it works!! Thanks..

        Yes, it can. It also clears it out each time you call find(). I suggest you reduce the code to the smallest case that reproduces the problem and post it because I don't think you have correctly diagnosed the problem.

                - tye (but my friends call me "Tye")