write to specified outputdir