Added directory output support.