use mkdir to create root folders before writing files