0

I am trying to use kdb q script to download file from remote source. How can I make the download keep going if there is an error? also, how can i mark it down what its downloaded in linux when there are other files in the same directory???

Here is my code:

file:("abc.csv";"def.csv");
dbdir:"/home/terry/";
dlFunc:{
  system "download.sh abc.com user /"get /remote/path/",x /",dbdir};
dlFunc each file;
Terry
  • 523
  • 9
  • 21

1 Answers1

3

If you're asking how to continue downloading other files if one file fails then you can put a protected eval around your dlFunc each file, e.g.

@[dlFunc;;()]each file;

You could capture the list of failed files using something like:

badfiles:();
{@[dlFunc;x;{y;badfiles,:enlist x}x]}each file;

Then inspect the badfiles list afterwards. The ones that succeeded would be:

file except badfiles
terrylynch
  • 11,844
  • 13
  • 21
  • thanks!! do you know how to track what its downloaded to the disk? – Terry Dec 01 '20 at 15:07
  • 1
    this is covered by the last part in Terry's answer. `file except badfiles` will be a list of all files which successfully downloaded as they aren't in `badfiles` – Matt Moore Dec 01 '20 at 16:07