Forum Discussion

izzy_babcock's avatar
izzy_babcock
New Contributor II
4 years ago
Solved

How to list file names from an FTP in another file?

Hello snapLogic Community!
I am very new to the solution, but loving it more each day 🙂

I am trying to read the name of files from an FTP directory and write the details to a separate file within the pipeline project folder.

I checked this post’s response, but this is listing assets in the SnapLogic environment, and I am looking to list the name of all files in an FTP location and print out the name of the files to a csv file or json.

Does anyone have any suggestions on how I can accomplish this?
Thank you in advance!

  • SpiroTaleski's avatar
    SpiroTaleski
    4 years ago

    @izzy.babcock

    Once you run the pipeline, the file is stored in the same project space where the pipeline is located. You can download the file, and the data will be in human-readable format.

    The Directory Browser Snap on the output in the $Name it references the Name of the file on that location.

    Regards,
    ST

8 Replies

  • bojanvelevski's avatar
    bojanvelevski
    Valued Contributor

    The pipeline below contains a script to flatten the data completely by iterating through every level of the JSON structure. You’ll probably need to include a counter to stop (or start) at certain point to adapt the solution according to your issue.

    Python flatten data_2022_06_06 (1).slp (7.1 KB)

  • bojanvelevski's avatar
    bojanvelevski
    Valued Contributor

    This is some kind of partial flattening of the data, which can be achieved with a Script. If this is the only part that needs to be modified, than it can also be transformed with an expression, but if the data contains more objects that are needed to be flattened out, than I suggest you to use Script.