Link to home
Start Free TrialLog in
Avatar of rajsan1
rajsan1

asked on

transfer text file from Unix to Windows shared drive

Hi
Can any one help me in writing script to transfer textfile from unix box to windows shared drive?

I don't have Samba, Only method I can you is ftp or Perl Script.
Can you help me in writing Perl script or ftp scritp.
Windows servername =USA1234DR
Unix Servername = UXDVE12

My file is in
$home/usr> ls
test.txt

I want to copy to my windows shared drive \\USA1234DR\workingdir

Thanks
Raj
ASKER CERTIFIED SOLUTION
Avatar of lk-data
lk-data
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Adam314
Adam314


use Net::FTP;
 
$ftp = Net::FTP->new("USA1234DR.your.company", Debug => 0)
  or die "Cannot connect: $@";
 
$ftp->login("username",'password')
  or die "Cannot login ", $ftp->message;
 
$ftp->cwd("/workingdir")
  or die "Cannot change working directory ", $ftp->message;
 
$ftp->put("your.file")
  or die "get failed ", $ftp->message;
 
$ftp->quit;

Open in new window

Avatar of rajsan1

ASKER

I am getting error when I compile this code
Can't locate Net/FTP.pm in @INC (@INC contains: /opt/per15/lib/5.00502/PA-RISC1.1
Can you help me..

OR Is it possible in ftp script
From a prompt as root:
    cpan Net::FTP
OR
    perl -MCPAN -e 'install Net::FTP'
You need SAMBA installed on UNIX client machine. Then you can use smbclient to transfer file to windows share.
Alternatives are NFS server included with MS-SFU, or using least common denominator - FTP

http://hpux.connect.org.uk/hppd/hpux/Networking/Misc/samba-3.0.10/