UNPKG

analytics-renamer

Version:

File Renamer is a Python script that renames all files in a specified folder by converting names to lowercase, removing Vietnamese accents, eliminating punctuation, and replacing spaces with hyphens.

123 lines (72 loc) 4.13 kB
# File Renamer File Renamer is a Python script that renames all files in a specified folder by converting names to lowercase, removing Vietnamese accents, eliminating punctuation, and replacing spaces with hyphens. It provides a simple command-line interface for batch file renaming. ## Installation Guide To use the tool, you need Python 3.x and the unidecode library. Install the required dependency using pip: ``` npm install unidecode ``` No additional dependencies are required beyond a Python environment. ## PurposeRename all files in a folder to a standardized format. – Convert file names to lowercase. – Remove Vietnamese accents (e.g., _Hà Nội_ becomes _Ha Noi_). – Remove punctuation (e.g., _file,name!.txt_ becomes _filename.txt_). – Replace spaces with hyphens (e.g., _my file.txt_ becomes _my-file.txt_). ## Workflow 1. Run the script: Execute the script in your terminal or command prompt. 2. Enter folder path: Input the path to the folder containing files to rename. Enter 0 to exit. 3. Automatic renaming: The script processes all files in the specified folder, applying the renaming rules. 4. Review results: The script displays the old and new names of each file and a summary of processed files. ## Example usage in terminal: ``` python rename_files.py ``` Sample interaction: ``` Vui lòng nhp đường dn thư mc (0 để thoát): D:\MyFolder Đang xlý… Đã đổi tên: My File!.txtmy-file.txt Đã đổi tên: Hà Ni_Document.pdfha-noi-document.pdf Đã xlý 2/2 tp. ``` ## Contact & Support Email: info@nhavan.vn. Website: nhavan.vn. If you have any questions or suggestions, feel free to reach out for the fastest support. Dont forget to star this repository if you find it useful. # Công cụ đổi tên tp Công cụ đổi tên tp là mt tp lnh Python giúp đổi tên tt ccác tp trong mt thư mc được chỉ định bng cách chuyn tên sang chthường, xóa du tiếng Vit, loi bdu câu và thay khong trng bng du gch ngang. Công ccung cp giao din dòng lnh đơn gin để đổi tên hàng lot. ## Hướng dn cài đặt Để sdng công cụ, bn cn Python 3.x và thư vin unidecode. Cài đặt thư vin cn thiết bng npm: ``` npm install unidecode ``` Không yêu cu thêm thư vin phthuc ngoài môi trường Python. ## Công dng – Đổi tên tt ctp trong thư mc sang định dng chun hóa. – Chuyn tên tp sang chthường. – Xóa du tiếng Vit (ví dụ: _Hà Nội_ thành _Ha Noi_). – Loi bdu câu (ví dụ: _tệp,này!.txt_ thành _tep-nay.txt_). – Thay khong trng bng du gch ngang (ví dụ: _tệp của tôi.txt_ thành _tep-cua-toi.txt_). ## Flow thao tác 1. Chy tp lnh: Thc thi tp lnh trong terminal hoc command prompt. 2. Nhp đường dn thư mc: Nhp đường dn đến thư mc cha các tp cn đổi tên. Nhp 0 để thoát. 3. Đổi tên tự động: Tp lnh xlý tt ctp trong thư mc, áp dng các quy tc đổi tên. 4. Xem kết quả: Tp lnh hin thtên cũ và mi ca mi tp cùng tóm tt slượng tp đã xlý. Ví dsdng trong terminal: ``` python rename_files.py ``` Ví dtương tác: ``` Vui lòng nhp đường dn thư mc (0 để thoát): D:\MyFolder Đang xlý… Đã đổi tên: My File!.txtmy-file.txt Đã đổi tên: Hà Ni_Document.pdfha-noi-document.pdf Đã xlý 2/2 tp. ``` ## Liên h& HtrEmail: info@nhavan.vn. Website: nhavan.vn. Nếu bn có câu hi hoc đề xut, đừng ngn ngi liên hệ để được htrnhanh nht. Đừng quên star repository này nếu bn thy nó hu ích.