Novell Home

Remote Copy (NW to NW)

From Developer Community

Copies a file between two Netware servers using UCX. This example copies from the local server to a remote, but the code could be modified to copy from a remote server to a remote server. This code requires Perl 5.6, but older versions can use UCS2UCX instead of Perl2UCS.

Sample Code

#nwrcopy.pl
use Perl2UCS; 
$tree = 'DEVELOPMENT'; $context = 'org\\ou';
$username = 'transfer'; $password = 'transferpass';
$SOURCEFILE='SYS:etc\\hosts';
$DESTFILE='\\\\SERVER2\\SYS:hosts';
print "copy $SOURCEFILE -> $DESTFILE\n";

#Attach to NDS tree
$Login1=Perl2UCS->new("UCX:NWDir");
$Login1->{"FullName"} = "nds:\\\\$tree\\$context";
$Login1->login ($username,$password);
print "Short Name: " . $Login1->{"ShortName"} . "\n";

#Build FileSystemObject and use it to copy the file
$Fso1 = Perl2UCS->new("UCX:FileSystemObject");
$Fso1->copyfile($SOURCEFILE,$DESTFILE) or print "$!\n";

$Login1->logout();

--algaeman

Novell® Making IT Work As One

© 2009 Novell, Inc. All Rights Reserved.