How to copy files from mapped drive to server via my machine?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • parmarjm
    New Member
    • Oct 2010
    • 2

    How to copy files from mapped drive to server via my machine?

    Hi I am trying to copy files from mapped drive (J:\) to a different machine.
    The perl script is going to run on my machine to copy files from one place to another.

    File transfer works when i copy files from mapped drive to my machine but when I tried to copy over to different machine throws me an error:

    Please help me recrify

    Here is my perl script as follows:

    Code:
    use File::Copy; 
      
    $dir="\\\\SOURCE\\PROD_LOGFILES\\LogFiles\\"; 
    
    opendir(DIR, $dir) or die "can not open directory $dir: $! \n"; 
      
    @files=readdir(DIR); 
    closedir DIR; 
      
    foreach $file (@files) { 
      if (-f "$dir$file") {   
      
    $moveloc="\\\\TARGET\\D\$\\FMP Project\\Production Log Files\\";  
    
    $old = "$dir$file"; 
    $new = "$moveloc"; 
    #copy($old, $new) or die "Copy Failed: $!"; #this line is working for my machine
    move($old, $new) or die "Copy Failed: $!"; 
    }
    }
  • chorny
    Recognized Expert New Member
    • Jan 2008
    • 80

    #2
    What error message do you receive?

    Comment

    • parmarjm
      New Member
      • Oct 2010
      • 2

      #3
      Chorny
      I tried running the script got below error:

      C:\PERL\BIN>per l try_perl.pl
      Copy Failed: No such file or directory at try_perl.pl line 18.

      It seems didn't find the appropriate target directory to land files.

      can you please guide.
      Jay

      Comment

      Working...