SunQuest
           FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old September 16th, 2003, 01:19 AM
Diyar Diyar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Singapore
Posts: 54 Diyar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 54 sec
Reputation Power: 5
Question Can't seem to ftp to the right directory.

my program manage to log in using Net::FTP but i can't see to ftp the file to my directory on my server... i did try all routes to achieve my objective.... but still they give me an error message the foreach function below will get the individual name of the file after NET::FTP


Code:
foreach(@dircontents)
{
my $key=$_;
my $target_dir="/home/speg/diyar/TEST/RESULT";
my $wildcard=".txt";
$pathname=$ftp->pwd;

$totalpathname="$pathname\/$key";

           if($key=~"$wildcard"){
                   @mod_time=$ftp->mdtm($key);
                   print "Modification Time is @modtime";
                   print time2str("%C", @mod_time);

                   print "Pathname of the file: $totalpathname";
                   #the above code print out :  /home/transfer/diyar/TEST/FT1.txt
                   $ftp->put("$totalpathname",["$target_dir"]);
#the above code in pseuodocode is to transfer file /home/transfer/diyar/TEST/FT1.txt to /home/speg/Cyril/
           }
           ftp->quit
}

i CANNOT get to transfer the file from that directory to my own directory... and i don't know how to make a condition whereby if the target_directory is not valid in my server then create that target directory.... i know using the mkdir ($target_dir) but i dont know what to put for the if else condition...

Help needed. Thanks
__________________
U go PERL.. perlomatic

Reply With Quote
  #2  
Old September 16th, 2003, 09:59 AM
webmasta's Avatar
webmasta webmasta is offline
Senior Member
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Aug 2003
Location: Toronto
Posts: 1,614 webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 m 38 sec
Reputation Power: 7
Could try

unless(-e "$target_dir") {
mkdir ($target_dir);
}
__________________
webM

for $i(0..20){for($j=0;$j<=$i;$j+=2){print pack(qq{H2},
substr(qq{5f5745424d415354415f},$j,2));}print qq{\n};};

Reply With Quote
  #3  
Old September 16th, 2003, 10:11 AM
Kaicy Kaicy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 26 Kaicy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m 46 sec
Reputation Power: 0
so what does that litle signature code of urs do webM?

Reply With Quote
  #4  
Old September 16th, 2003, 10:29 AM
webmasta's Avatar
webmasta webmasta is offline
Senior Member
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Aug 2003
Location: Toronto
Posts: 1,614 webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level)webmasta User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 21 m 38 sec
Reputation Power: 7
LOL Kaicy.. If I tell ya, then I'll have to kill ya.

Reply With Quote
  #5  
Old September 17th, 2003, 03:06 AM
Diyar Diyar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Singapore
Posts: 54 Diyar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 54 sec
Reputation Power: 5
thanks a million webmasta... it works... should have known .... my brain full of C and C++... use alot of if else thingy... now i know how to use unless..... WeeeEEeee... thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Can't seem to ftp to the right directory.


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway