in reply to Updating files over multiple servers

I use the following code (on Windows) to map network drives to my local machine, then do any file manipulation that I need to as if it were a local drive, and finally disconnect the drive again.
###################################################################### # Function: MapNetworkShare # # Description: Map the remote network share to a local drive # # # # Arguments: LOCAL_MOUNT - Local drive letter WITH colon and NO \ # # i.e. I: # # REMOTE_HOST # # REMOTE_SHARE # # REMOTE_USER # # REMOTE_PASS # # # ###################################################################### sub MapNetworkShare { my $LOCAL_MOUNT=shift(@_); my $REMOTE_HOST=shift(@_); my $REMOTE_SHARE=shift(@_); my $REMOTE_USER=shift(@_); my $REMOTE_PASS=shift(@_); # Check for locally mapped drive if ( -d "$LOCAL_MOUNT\\" ) { &UnMapDrive($LOCAL_MOUNT); } # Map remote share $REMOTE_HOST=~s/^\\\\//; #Trim leading \\ if specified &LogMsg ("Mapping remote share \\\\${REMOTE_HOST}\\${REMOTE_SHARE} +as $LOCAL_MOUNT"); $command="net use $LOCAL_MOUNT \\\\${REMOTE_HOST}\\${REMOTE_SHARE}" +; if ($REMOTE_USER ne '' && $REMOTE_PASS ne '') { &LogMsg("Using remote user $REMOTE_USER"); $command.=" /user:${REMOTE_USER} $REMOTE_PASS"; } $out = `$command`; if ( -d "${LOCAL_MOUNT}\\" ) { &LogMsg ("Drive successfully mapped"); return 1; } else { &LogMsg("ORADBA-1047-013: Unable to map drive: $!\n$out"); return($out); } } ###################################################################### # Function: UnMapDrive # # Description: Un-map a local drive if mapped. # # Arguments: The drive (with : but no \) to unmap. # ###################################################################### sub UnMapDrive { my $LOCAL_MOUNT=shift(@_); # Clean up locally mapped drive if ( -d "$LOCAL_MOUNT\\" ) { &LogMsg ("Un-mapping local mount $LOCAL_MOUNT"); $out = `net use ${LOCAL_MOUNT} /del`; if ($? != 0) { &DieMsg("ORADBA-1047-014: Unable to unmount $LOCAL_MOUNT\n${!}$ou +t"); } } else { &LogMsg("Local drive $LOCAL_MOUNT does not exist, unable to unma +p"); } return; }
Good luck