Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 28th, 2012, 02:50 PM
mpride mpride is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 mpride User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 4 sec
Reputation Power: 0
Net::FTP put error - Array

I'm am not a programmer by any means but I have used Perl to accomplish a few tasks in the past. At the moment I need a script to read file names from a file that I create from an 'ls' command. Then I need it to connect to a remote server and put those file(s) in the remote directory.

When I run the script I get the following error:

# ./ftp_logs2.sh
Bad remote filename '20121221.log
'
at ./ftp_logs2.sh line 33

I have checked the file that I create on line 8 and there are no spaces etc. Here is a sample for the 'filelist' file:

20121221.log
20121222.log
20121223.log

I have also included 'print' statements at times within the script to print the contents of the array and it seems fine. I'm not sure what I'm missing. It's such a simple script but......

Here it is. Please don't kill me for lack of comments and
indentation etc.

#!/usr/bin/perl -w
########################################
{
chdir("/var/log/wireless");
system ("find \*.log -type f -mtime +1 >>filelist");
$userid = "memorial\\cw2000";
$password = "g0ldfing3r";
$list = "/var/log/wireless/filelist";
open("list");
@array = <list>;
close("list");
$file = shift(@array);
do
{
use Net::FTP;
$ftp = Net::FTP->new("10.9.80.38");
$ftp->login("$userid", $password)
or die "Cannot login ", $ftp->message;
$ftp->ascii;
$ftp->cwd("/wireless/syslog")
or die "Cannot change working directory ", $ftp->message;
$ftp->put($file);
}
until (@array eq 0);
$ftp->quit;
}
system ("rm -f /var/log/wireless/filelist");

Reply With Quote
  #2  
Old December 28th, 2012, 05:05 PM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 506 Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Days 19 h 5 m 2 sec
Reputation Power: 385
Quote:
Originally Posted by mpride
Please don't kill me for lack of comments and
indentation etc.


As I told you in your cross-post in Perl Gurus, why should we want to kill you for that? No point, really. You are shooting the bullet into your head yourself, you don't need any help for your suicide, you're doing it yourself very properly and very efficiently...

For more detailed comments on your code, please refer to the post in the Perl Gurus forum.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Net::FTP put error - Array

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap