nanoterabeta
asked on
get a file with variable filename using ftp
I want to get a file using ftp from a remote host, but the file name is variable:
fix_part.xyz
in which xyz is timestamp, it can be 1191690121 and changed daily
so i can not use a fix file name to get it
how do I solve this???
fix_part.xyz
in which xyz is timestamp, it can be 1191690121 and changed daily
so i can not use a fix file name to get it
how do I solve this???
ASKER
can you explain furthermore Talmash??
send me the ftp command for fixed file name
ASKER
if filename is "IPmeas.202.yes", I just simply use this:
$ftp=Net::FTP->new("$host" ,DEBUG=>0) ;
$ftp->login("","");
$ftp->ascii;
$ftp->get("IPmeas.202.yes" ,"/IPmeas. 202.yes");
but if it is "IPmeas.202.yes.xyz" and I don't know for sure what xyz is for today, I can't get it
$ftp=Net::FTP->new("$host"
$ftp->login("","");
$ftp->ascii;
$ftp->get("IPmeas.202.yes"
but if it is "IPmeas.202.yes.xyz" and I don't know for sure what xyz is for today, I can't get it
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
are you sure that this will work??? @files=grep {/^fix_part\./} @files;
not recommended.
afaik, it won't work.
print it out BEFORE and AFTER the action, and see.
I never do such actions.
afaik, it won't work.
print it out BEFORE and AFTER the action, and see.
I never do such actions.
I don't see anything wrong with that. The grep will get the files that begin with the literal "fix_part.".
this code :
for $p (0..27) {
open(SRC,"tmp_2962_rx_$p")
}
replace:
open(SRC,"tmp_2962_rx_0");
open(SRC,"tmp_2962_rx_1");
...
open(SRC,"tmp_2962_rx_27")