remove files rather than overwrite
This commit is contained in:
parent
a53ecbf8f0
commit
a32d4bfd9d
@ -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
|
# Write the new content back to the file
|
||||||
file_path = os.path.join(dest_path, filename)
|
file_path = os.path.join(dest_path, filename)
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
os.remove(dst_file)
|
os.remove(file_path)
|
||||||
|
|
||||||
with open(file_path, 'w') as file:
|
with open(file_path, 'w') as file:
|
||||||
file.write(new_content)
|
file.write(new_content)
|
||||||
|
Loading…
Reference in New Issue
Block a user