Requirement: we have two different folders eg: input and output Input folder contains different files, here we need to write the files to the output folder with the same file names based on the time stamp that is created.
Note: File should be write based on the time that is created eg: First in First Out.
You can use the List operation of the File connector. It returns an array for each matching file in a directory. Each entry contains in the payload the contents of the file but also attributes like
creationTime
.You can sort the list using this criteria with a DataWeave expression. For example
payloadd orderBy ($.attributes.creationDate)
.Then iterate over each with a foreach to write each entry as a separate file using the Write operation.
Example: