Capture DIRLISTONLY response from curl

Is there a way to capture DIRLISTONLY response from curl, it goes to console ok but I really need to read it to establish what the last file is. Doing a restore latest backup thingy. I see parameter 1 works like expected, but I don’t see a way to redirect it to say a string or something.

curl.setOption(DIRLISTONLY,1);
curl.perform();

Edit: Tried curl.getinfo with some codes but didn’t see anything relevant to this though.

I get the feeling when reading the cURL documentation that this is a modifier on an ordinary request.

Let’s say you got a request like this (sorry if my code is a little wrong!)

var curl = new CURL();
curl.setOption(URL, "path/to/directory/listing/");
curl.setOption(WRITEFUNCTION, onWrite);
curl.perform();

It sounds like this would retrieve the long version of the directory listing (with file dates and sizes) but you can add this option to get a shorter directory list

var curl = new CURL();
curl.setOption(URL, "path/to/directory/listing/");
curl.setOption(DIRLISTONLY, true);
curl.setOption(WRITEFUNCTION, onWrite);
curl.perform();

It looks like Lime also treats the option as a Boolean and not an Int

I think you’re dead on.
You can either get the short dir with just name+ext or a dir in long form with time stamps and other stuff.
Only thing is it outputs to console but I can’t seem to get hold of the list to further manipulate it. I even tried “>” operator in cmd.exe to “pipe” it to a file, but it doesn’t get captured because it is just from the verbose in the running app.
Do you think there’s some chance of redirecting the output to something else than console ?

So it’s bypassing the WRITEFUNCTION? All the samples I see online seem to suggest that it returns the result just like it would a normal HTTP request (but the file list is the data instead)

1 Like

Oh… wait, nevermind me.
You’re correct, I was checking the wrong file… the one with the original WRITEFUNCTION from the download file @singmajesty.
Double thanks. :slightly_smiling_face:

1 Like