remove files rather than overwrite

This commit is contained in:
OddlyTimbot 2024-09-21 21:32:25 -04:00
parent a53ecbf8f0
commit a32d4bfd9d

View File

@ -16,7 +16,7 @@ def replace_word_in_files(target_word, replacement_word, folder_path=".", dest_p
# Write the new content back to the file
file_path = os.path.join(dest_path, filename)
if os.path.exists(file_path):
os.remove(dst_file)
os.remove(file_path)
with open(file_path, 'w') as file:
file.write(new_content)