Compare two file name from a folder

Kumar_AyushKumar_Ayush Member Posts: 7 Newbie
how I can compare the file names which are read via loop files, if first 15 characters are same then merge those files and create a new file with those 15 characters followed by "_0_1"


  • Options
    BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn

    I would use Loop Files first to build a file list. Activate "enable macros" and inside the loop add the current file name to a list. For example, create an empty example set before the loop with a "filename" attribute, Remember it, Recall it inside the loop and create a new example set with the current file name and append it.

    At the end of the loop, append the resulting collection. Now you have a list of file names.

    You can use Generate Attributes to get the first up to 15 characters of the file name, aggregate on the new short filename attribute and count the data. Then you know which files have 2 or more identical prefixes. Now you can work on this list e. g. with Loop Values, generate the new file name, Loop Files with the prefix, read the files, append their contents, and write them into the new file name. Maybe you would also delete the original files if necessary here.


Sign In or Register to comment.