I have below scenario.
Source : Oracle/File
I want store all distinct dates in context variable and use to create folder based on dates, store records inside directory only specific to that date.
There are a couple of things to think about here. First of all, you will need to be able to use a bit of Java to manipulate your date information to get the required String to build your folder path. Take a look here: https://www.talendforge.org/forum/viewtopic.php?id=17451
The above should give you an idea of how to achieve this using Talend system routines.
The next bit to consider is a little bit more complicated. You can create your folder when you create a file that needs to be written in that folder. That is easy enough. SO you will not have to worry about preemptively creating your folder and then writing your file there. But it looks like you will need to keep changing the file you are writing to in a single flow.....which does not work out of the box. You will need to group your data by output file and iterate over that group so that your file is created and written to in separate flows......which is a pain.
Or (if you are not scared of a little Java) you can follow what I have done in this tutorial....https://www.rilhia.com/tutorials/load-data-dynamic-number-files