toolkit / txt2tags
k4d3's picture
update every stupid script
c2cc76d
raw
history blame
674 Bytes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from pathlib import Path
def rename_txt_to_tags(target_dir='.'):
for root, dirs, files in os.walk(target_dir):
for file in files:
if file.endswith('.txt'):
txt_file = Path(root) / file
tags_file = txt_file.with_suffix('.tags')
os.rename(txt_file, tags_file)
print(f"Renamed {txt_file} to {tags_file}")
if __name__ == '__main__':
target_directory = input('Enter the target directory (leave blank for current directory): ')
if not target_directory:
target_directory = '.'
rename_txt_to_tags(target_directory)