setup:
MultipleOutputs.addNamedOutput(job, "Output", TextOutputFormat.class, Text.class, Text.class);
setup of reducer:
mout = new MultipleOutputs<Text, Text>(context);
calling mout in reducer:
String key; //set to whatever output key will be
String value; //set to whatever output value will be
String outputFileName; //set to absolute path to file where this should write
mout.write("Output",new Text(key),new Text(value),outputFileName);
you can have a piece of code determine the directory while coding. For example say you want to specify directory by month and year:
int year;//extract year from data
int month;//extract month from data
String baseFileName; //parent directory to all outputs from this job
String outputFileName = baseFileName + "/" + year + "/" + month;
mout.write("Output",new Text(key),new Text(value),outputFileName);
Hope this helps.