rewrite files