By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,645 Members | 1,048 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,645 IT Pros & Developers. It's quick & easy.

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

P: 2
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:

Expand|Select|Wrap|Line Numbers
  1. use File::Copy; 
  2.  
  3. $dir="\\\\SOURCE\\PROD_LOGFILES\\LogFiles\\"; 
  4.  
  5. opendir(DIR, $dir) or die "can not open directory $dir: $! \n"; 
  6.  
  7. @files=readdir(DIR); 
  8. closedir DIR; 
  9.  
  10. foreach $file (@files) { 
  11.   if (-f "$dir$file") {   
  12.  
  13. $moveloc="\\\\TARGET\\D\$\\FMP Project\\Production Log Files\\";  
  14.  
  15. $old = "$dir$file"; 
  16. $new = "$moveloc"; 
  17. #copy($old, $new) or die "Copy Failed: $!"; #this line is working for my machine
  18. move($old, $new) or die "Copy Failed: $!"; 
  19. }
  20. }
  21.  
Oct 26 '10 #1
Share this Question
Share on Google+
2 Replies


Expert
P: 80
What error message do you receive?
Oct 28 '10 #2

P: 2
Chorny
I tried running the script got below error:

C:\PERL\BIN>perl 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
Nov 1 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.