|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
To check for condition during NET::FTP
Is it possible to check the file using some conditions during Net::FTP? or is there any other wae...?
erm... i did read the Net:: FTP documentation and mostly i understand... but it doesnt help what i wish to do... my OBJECTIVES is making a program that 1. my server(A) ftp and connect to a given machine(B) by their IP address 2. check the time , date and size of the file in (B) 3. check if files in (B) already in server (A) and is the same (size) in server(A) 4. The machine (B) keep processing new files... so must check check whether the file is still in use 5. Copy the files from machine(B) to my server(A) but don't copy the files that is stiil in process and don't copy the files that is already in server(A) specification of machine B: This machine B will generate files constantly specification of my program in Server A: It will get all the files except for the files which is still generating, from Machine B. ermm... get the logic? well it needs to run some condition before it copy the files to my own server. and im working on Server(A) for the subroutine Net::FTP i manage to list the all files from that machine(B) on my server(A) Code:
sub netftp{
use Net::FTP;
my hostname="$ip"; #where i assign 112.11.125.45 to the $ip variable on my main function
my home="/home/transfer/diyar/FT1";
$ftp = Net::FTP->new("$ip")|| die "Cannot connect to $ip";
$ftp->login("transfer",'transfer') ||die "Cannot Login",
$ftp->message;
$ftp->cwd($home);
@dircontents=$ftp->ls($home);
$ftp->quit;
foreach(@dircontents)
{
print"$_\n";
}
}
That, i know how to ftp and I did search in the forum on how to get and put the file name into my directory... which is Code:
$ftp->put($source fiel,$targetfile); But my 1st objective can be met but my 2nd to 5th objective, i do not know how to go around solving the problem... please help Tankz 19yr old Student
__________________
U go PERL.. perlomatic |
|
#2
|
|||
|
|||
|
typo error in the ferst message:
Code:
$ftp->put($sourcefile,$targetfile); Rephrase: Im able to do the 1st objective, but do not know how to achieve my 2nd to 5th objectives tankz |
|
#3
|
|||
|
|||
|
1. my hostmane better used as my $hostname as well as my home as my $home
2. you may also use dir to retrieve a full files list as if you would use ls -l. 3. received info may by saved into an array and parsed using split to get a prticular info you want. 4. based on this 'dump' you may decide which one to download. 5. don't know how to keep monitoring the transfer of files at the moment, but using socket module may give you a clue a way to go. |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > To check for condition during NET::FTP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|