Topic
  • 2 replies
  • Latest Post - ‏2014-03-10T22:04:43Z by juriggs
juriggs
juriggs
9 Posts

Pinned topic Getting a file listing from the remote node...

‏2014-03-03T19:29:55Z |

I'm modifying my processes so that they'll be a bit more robust and one of the things I'd like to do is get a listing of all the files in the remote directory.

I'm already doing this with CDFtp+, but I'd like to be able to do it with my server as well. I suppose I could do a Run Task or Run Job to execute the FTP script, but it would be a lot simpler if I could just have a line of code in my process that performed this action. Has anyone done this before, or have an idea of how it could be done?

Thanks,

Justin

  • VolkerFriedrich
    VolkerFriedrich
    157 Posts
    ACCEPTED ANSWER

    Re: Getting a file listing from the remote node...

    ‏2014-03-10T14:04:40Z  

    Hi Justin,

    CDFtp+ uses the standard C:D statements, so you can do something very similar with a process.

    First do an RUN TASK step on the SNODE to write the directory listing to an output file. Your process will specify both the directory as well as the output file. If successful, then do a COPY RECEIVE step to get the remote output file onto your local system.

    Using symbolic variables can make your process flexible, like in this simplified example:

    LISTDIR RUN TASK SNODE (PGM=Windows)
        SYSOPTS="cmd(dir ~"&RMTDIR~" >~"&RMTOUTFILE~")"

     IF (LISTDIR EQ 0) THEN

    GETLIST     COPY FROM (FILE="&
    RMTOUTFILE" SNODE)
            TO (FILE="&DIRLIST" PNODE DISP=RPL)

    EIF

  • VolkerFriedrich
    VolkerFriedrich
    157 Posts

    Re: Getting a file listing from the remote node...

    ‏2014-03-10T14:04:40Z  

    Hi Justin,

    CDFtp+ uses the standard C:D statements, so you can do something very similar with a process.

    First do an RUN TASK step on the SNODE to write the directory listing to an output file. Your process will specify both the directory as well as the output file. If successful, then do a COPY RECEIVE step to get the remote output file onto your local system.

    Using symbolic variables can make your process flexible, like in this simplified example:

    LISTDIR RUN TASK SNODE (PGM=Windows)
        SYSOPTS="cmd(dir ~"&RMTDIR~" >~"&RMTOUTFILE~")"

     IF (LISTDIR EQ 0) THEN

    GETLIST     COPY FROM (FILE="&
    RMTOUTFILE" SNODE)
            TO (FILE="&DIRLIST" PNODE DISP=RPL)

    EIF

  • juriggs
    juriggs
    9 Posts

    Re: Getting a file listing from the remote node...

    ‏2014-03-10T22:04:43Z  

    Hi Justin,

    CDFtp+ uses the standard C:D statements, so you can do something very similar with a process.

    First do an RUN TASK step on the SNODE to write the directory listing to an output file. Your process will specify both the directory as well as the output file. If successful, then do a COPY RECEIVE step to get the remote output file onto your local system.

    Using symbolic variables can make your process flexible, like in this simplified example:

    LISTDIR RUN TASK SNODE (PGM=Windows)
        SYSOPTS="cmd(dir ~"&RMTDIR~" >~"&RMTOUTFILE~")"

     IF (LISTDIR EQ 0) THEN

    GETLIST     COPY FROM (FILE="&
    RMTOUTFILE" SNODE)
            TO (FILE="&DIRLIST" PNODE DISP=RPL)

    EIF

    That's perfect. Thanks for the help!