Loop 2 directories and join each file with the other file
hi,
I am looking for a way to loop through files in 2 different directories and want to join both files from both directories, those files are named similar because each one file from one folder belongs to another file from the other folder, and I basically want to join the corresponding files together into 1 file from the 2 directories, the files don't have the same naming, but they are already in my repository in the same order (and also in the same alphabetical order in the directories)
Is there any way to loop through the files and join each of the corresponding files together, other than based on the names only? e.g some alphabetical order index or so?
Answers
Hi,
It is a bit hard to give you a working example without knowing exactly how your data sets look like but in general one of the operators "Loop" or "Loop Repository" should be useful here. But I think there needs to be at least some common name stem or numbering used for the filenames, otherwise it is going to be difficult. You could use the operators "Loop Repository" and "Rename Repository Enrtry" to achieve this...
Let's then say you have two repository folders with 10 files each and each file is named 1 to 10. You always want to join the corresponding numbers. In this case you could either just Loop from 1 to 10 and use the macro (more on macros here: http://community.rapidminer.com/t5/RapidMiner-Studio-Knowledge-Base/How-to-Use-Macros/ta-p/32966) for the iteration to fetch the two data sets.
Or you could loop through one repository folder and fetch the corresponding other one.
Hope this helps,
Ingo