Support overwriting files while flattening