Fetch list of file in existing FTP environment

Greetings all,
At present, I am engaged in working with an FTP system. While I am able to write to the FTP environment, I am facing difficulty in retrieving a list of files located in a particular directory through the use of the “FileSystem: listing subscriber”.

cc: @Gugi , @Roland

Hello @abubakar,

Could you please let us know what kind of difficulties you are facing?

In order to subscribe to the list of files within a particular directory, you can define the pattern of the files within the directory. For example, if you want to subscribe to a list of XML files within a directory named “files”, you can define the pattern as files/*.xml.

It will create a number of tasks (depending on how many files match the pattern within the directory), with each entity having the below properties.

{
  "date": "2023-04-18T05:31:00.000+00:00",
  "path": "test/file.xml",
  "size": 598,
  "dirname": "test",
  "basename": "file.xml",
  "filename": "file",
  "progress": 0,
  "extension": "xml"
}

i was able to understand how it works, now i have an issue.

The object shown in the image is the one that transported the outcome of my FTP file retrieval. My challenge lies in parsing the XML value of the root object, which has a dynamic name such as "Alumio-Genesis/ASN_#dev1017-A " or "Alumio-Genesis/ASN_#dev1018-A ". This makes it difficult to map the values and convert the child object (XML) to JSON

Screenshot 2023-05-04 at 18.17.53

Hello everyone. I was able to find a solution. Specifically, I utilized the value setter to gather all responses and store them in a new object named “test”. Then, I used the node transformer to iterate through all child objects of the “test” object by applying the pattern “test. *”. Please refer to the image below for a visual representation.

2 Likes

Hi @abubakar

We are glad that you were able to find the solution.

Yes, you can use the “Node, transform nodes” entity transformer to loop through an array or an object (associative array).

Thank you for sharing the solution.

1 Like