sub copyDat { my $file = basename($_[0]); my $path = dirname($_[0]); #$path .= "\\"; #trailing slash was needed for xcopy, but xcopy not as reliable as robocopy for full automation with better logging. print "\n File: $file \n\n"; print "\n Dirname: $path \n\n"; chomp $_[1]; my $map = $_[1]; my $map = $1 if($map=~/(.*)\\$/); #trailing slash not needed for robocopy, but not sure if it's as picky, but it definately needs a mapping and not a unc path to work. print "\nnet use $map && ROBOCOPY \"$path\" \"$map\" $file /B && net use $map /delete\n\n"; #I'll add some more flags to robocopy to jazz it up but want to get this sequence to work first. open TASK, "net use $map && ROBOCOPY \"$path\" \"$map\" $file /B && net use $map /delete 2>&1|" or die "cannot pushd $_[1]"; while () { print; #chomp; #chop; #return $_; } }