|
|
|
|
|
|
|
import os |
|
|
|
def remove_text_from_file(file_path, text_to_remove): |
|
with open(file_path, 'r') as file: |
|
content = file.read() |
|
|
|
content = content.replace(text_to_remove, "") |
|
|
|
with open(file_path, 'w') as file: |
|
file.write(content) |
|
|
|
def remove_text_from_files(root_dir, text_to_remove): |
|
for subdir, _, files in os.walk(root_dir): |
|
for file in files: |
|
if file.endswith('.txt') or file.endswith('.tags'): |
|
file_path = os.path.join(subdir, file) |
|
remove_text_from_file(file_path, text_to_remove) |
|
|
|
if __name__ == "__main__": |
|
root_directory = '.' |
|
text_to_remove = "grandfathered content, " |
|
remove_text_from_files(root_directory, text_to_remove) |
|
|
|
|