TechTalkz.com Logo Ask the Expert

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Linux & Opensource > Unix

Notices

Can anyone interpret this code from Perl to Korn Shell?

Unix


Reply
 
Thread Tools Display Modes
Old 15-09-2007, 11:08 AM   #1
mfarid1@yahoo.com
Guest
 
Posts: n/a
Can anyone interpret this code from Perl to Korn Shell?

-------------------------------------------------
#!/usr/bin/perl
use Net::FTP;
$ftp = Net::FTP->new("some.host.name", Debug => 1)
or die "Cannot connect to some.host.name: $@";
$ftp->login("anonymous",'-anonymous@')
or die "Cannot login ", $ftp->message;
$ftp->cwd("/myfolder")
or die "Cannot change working directory ", $ftp->message;
$ftp->binary;
for( <*.tmp> ){
$ftp->put($_,"tmp.$$") or die $!; #(This has to be put in my case)
$ftp->rename("tmp.$$",$_) or die $!;
$ftp->size($_) == -s $_ or die "$_ sizes don't match";
}
$ftp->quit;
-----------------------------------------------
What I have so far:

#!/bin/ksh
cd /MyUnixDir
/usr/bin/ftp -n some.host.name <<EOF
user MyID MyPwd
cd /WindowsFolder
binary
prompt
mget *.zip
cd WindowsSubFolder
mput *.zip
cd ..
mdelete *.zip
bye
EOF

unzip *.zip
gunzip -d *.gz
-----------------------------------------------

Some more help needed so there will be additional code along with what
is there above. I need to do the following:

1)I will be working with .zip files NOT .tmp files
2)I need to copy .zip files from Windows to my Unix folder and name the
..zip files as something else, let's say, .txt.
There could be multiple .zip files in the Windows folder.
3)Once the file(s) are copied completely, a size comparison needs to be
made between the Windows and Unix sides.
4)If the sizes are the same, then I need to rename the .txt file back
to the .zip file.

Thanks to anyone who responds.

  Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl Conversion chris.santry@gmail.com VB.NET 1 15-09-2007 10:35 AM
ClearQuest API for PERL and VB and NOT FOR C#? RocketMan C#(C Sharp) 1 05-09-2007 02:39 PM
HTML/PERL/CGI on my own machine? Dave Murray Debian Linux 10 29-08-2007 07:47 PM
Blue screen crash data...how do you interpret it? genericaudioperson@hotmail.com Windows XP 6 16-08-2007 01:04 PM
Perl Script Unknown Programming 0 17-12-2006 01:37 AM


< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 09:36 PM.


vBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2010, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional