Write files to proper dir