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

    • izzy_babcock's avatar
      izzy_babcock
      New Contributor II

      Thank you for your reply @Spiro_Taleski.
      I had read over the documentation, but I am not sure how to actually get it to list the file names into another file. Which snaps should I use in this case?

      • SpiroTaleski's avatar
        SpiroTaleski
        Valued Contributor

        @izzy.babcock

        Once you get all the files from the ftp location using the Directory Browser Snap, you can use a Mapper Snap in order to map necessary fields produced by the Directory Browser Snap.

        My question is: Do you want only to print/store the file names from ftp in one file in SnapLogic? Or do you want for each file on ftp to create separate file in SnapLogic project folder?

        Based on the type of the file(csv, json, xml, excel), that you want to store the details, there are designated Snaps for each like: JSON Formatter, CSV Formatter etc.

        Regards,
        Spiro Taleski

    • izzy_babcock's avatar
      izzy_babcock
      New Contributor II

      Hi @Spiro_Taleski,

      Thank you for sharing this sample pipeline with me.

      When I run it (after updating it so it reflects my files), the result is an .xlsx with binary content, but I thought that the file writer would read binary and write it as document to the endpoint. Am I missing something?

      Also, how do you know that $Name references the name of the file in a directory? How do I know what can be referenced as a variable/field for a specific snap?

      Thanks in advance.

      Best,
      Izzy Babcock

      • SpiroTaleski's avatar
        SpiroTaleski
        Valued Contributor

        @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