flatten serialize dir