Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FTP with wildcard
#1
How can I download a file from FTP with wildcard in the filename? There is always only one file to download and its name is different every day.
So far macro below identifies correct filename but how to download it?

Ftp f.Connect("xxx.xxx.xxx.xxx" "username" "password" 0 0 1)

;If need, change current ftp directory to the directory where the file is
if(!f.DirSet("/")) end "failed to set FTP current directory"
ARRAY(STRINT) a

f.DirAll("*" a 2)
int i
for i 0 a.len
,out "%s%s" a[i].s iif(a[i].i " (folder)" "")

;Download to dir
f.SetProgressDialog(1)
if(!f.FileGet("?" "C:\Store\filename.gz")) end "failed to download"

mes "Completed!"
#2
Macro Macro1806
Code:
Copy      Help
Ftp f.Connect("xxx.xxx.xxx.xxx" "username" "password" 0 0 1)

;If need, change current ftp directory to the directory where the file is
if(!f.DirSet("/")) end "failed to set FTP current directory"
ARRAY(STRINT) a

f.DirAll("*" a 2)
int i
for i 0 a.len
,if(a[i].i) continue ;;folder
,out a[i].s
,
,;Download to dir
,f.SetProgressDialog(1)
,if(!f.FileGet(a[i].s F"C:\Store\{a[i].s}")) end "failed to download"

mes "Completed!"
#3
Works perfectly. Thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)