Link to home
Start Free TrialLog in
Avatar of nanoterabeta
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???
Avatar of Talmash
Talmash
Flag of Israel image

as for "open" command, same for ftp:

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");
Avatar of nanoterabeta
nanoterabeta

ASKER

can you explain furthermore Talmash??
send me the ftp command for fixed file name
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
SOLUTION
Avatar of Talmash
Talmash
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
I don't see anything wrong with that.  The grep will get the files that begin with the literal "fix_part.".