In some data integration cases you may want to divide your data into separate parts, depending on a source field. This flow takes source data XML and as part of each XML record it splits the data based on a particular field in the source and then creates an individual output file. If a folder doesn't exist, it will create the folder.
Refer to the attached process flow PDF. It includes the custom code (Custom plugin).