Facility Control

 View Only
  • 1.  Getting file list using asyncFTPListFiles stack.

    Posted 12-30-2018 12:04

    Hello

    I'm trying to get an file list from GV K2 video server via FTP (which is very simple operation).

    This is my code (that i found here on this forum):

    function outputResults(success, files, exception)
    {
    if (!success)
    {
    ogscript.debug(" FAIL");
    return;
    }
    else if (files != null)
    {
    ogscript.debug("GOT " + files.length + " FILES");
    for (var i = 0; i < files.length; i++)
    {
    var jsTime = (new Date(files[i].getTimestamp().getTimeInMillis()));
    if (files[i].isDirectory())
    {
    ogscript.debug("GOT DIRECTORY: " + files[i].getName());
    }
    else
    {
    ogscript.debug("GOT FILE: " + files[i].getName() + " " + jsTime);
    }
    }
    }
    }
    ogscript.asyncFTPListFiles('10.168.1.233', 21, 'mxfmovie', 'password', 'V:\MXF\NEW', outputResults);

    When i hit an button to trigger that code - nothing happens. Debug window is empty - On server side i see in log that user is connecting.
    When i browse to ftp via cmd or browser - all works great!
    When i connect with "mxfmovie" user - i stands in V:\MXF\ , which contains only folder. In each folder there is an clips. I tried many variants with "destanation" argument, "" - blank, "\new" - relative, "V:\MXF\NEW" - absolute.. But nothing.

    Is there any documentation of asyncFTPListFiles ? I feel that i miss something.. but i don't know where to seek. Please help!

    Thanks,

    Alex.



  • 2.  RE: Getting file list using asyncFTPListFiles stack.

    Posted 01-02-2019 14:59
    I see that there are backslashes in your path - have you tried escaping them? The backslash is a reserved character in Javascript and is used so you can output characters like carriage return or newline. If you want an actual backslash, you need to escape it with another one. So, to get the literal "", I would have to use "\"
    ogscript.asyncFTPListFiles('10.168.1.233', 21, 'mxfmovie', 'password', 'V:\\MXF\\NEW', outputResults);
    #DashBoard