Question

Does anybody know if there is any way to download files from ftp server directly from Q (kdb) ? I know that it's possible to use http but didn't see any examples of using ftp. Seems only way is to write wrapper around something like curl etc, but may be it is already done ? Any thoughts ?

Was it helpful?

Solution 2

use a system call to curl without a file destination -- its default destination is stdout, so the file contents will be returned to q as the return value of system

data:system"curl ftp://wherever/whatever"

OTHER TIPS

Why not either:

  • Write a script to fetch the file then start the q processing.
  • Use a system command to call any linux/dos commands you want, then use the kdb key command to check that the files exist as expected

For Linux, you can simply run any curl command or system command using q. I used following for example:

system "curl --proxy my_proxy_details ftp://ftp.microsoft.com/developr/visual_c/README.TXT -o README.txt"

-> -o option is to give name for the downloaded file.

Similarly you can run other curl commands or other system commands to get ftp files in Q.

This site has good curl examples: http://www.cyberciti.biz/faq/curl-download-file-example-under-linux-unix/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top