Hi All,

 

I want to write a single Perl script to copy some files from one machine
to another. Those can be windows or unix. Is that possible to have one
script to do it?

 

The script that I have written is as follows which do the job for
windows to windows. The problem here is if user says target as
/usr/abc/pqr then it will fail as it will try to copy it to location as
"/usr/abc/pqr\codebase\iba.properties".

 

How can I work with / and \ here?

 

---code-

 

#!/usr/bin/perl

use strict;

use warnings;

use File::Copy;

 

my $Source = q{D:\Folder1\Folder2};

my $Target = q{D:\FolderA\FolderB};

 

copy("$Source\\codebase\\iba.properties",
"$Target\\codebase\\iba.properties") 

                              or die "***** ATTENTION!!!! Aborting the
script as failed to copy : $!";

 

----end-----

 

Thanks,

Paryushan

 

Reply via email to