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
Markdown
# 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.
## Purpose
– Rename 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 nhập đường dẫn thư mục (0 để thoát): D:\MyFolder
Đang xử lý…
Đã đổi tên: My File!.txt → my-file.txt
Đã đổi tên: Hà Nội_Document.pdf → ha-noi-document.pdf
Đã xử lý 2/2 tệp.
```
## 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.
Don’t forget to star this repository if you find it useful.
# Công cụ đổi tên tệp
Công cụ đổi tên tệp là một tập lệnh Python giúp đổi tên tất cả các tệp trong một thư mục được chỉ định bằng cách chuyển tên sang chữ thường, xóa dấu tiếng Việt, loại bỏ dấu câu và thay khoảng trắng bằng dấu gạch ngang. Công cụ cung cấp giao diện dòng lệnh đơn giản để đổi tên hàng loạt.
## Hướng dẫn cài đặt
Để sử dụng công cụ, bạn cần Python 3.x và thư viện unidecode. Cài đặt thư viện cần thiết bằng npm:
```
npm install unidecode
```
Không yêu cầu thêm thư viện phụ thuộc ngoài môi trường Python.
## Công dụng
– Đổi tên tất cả tệp trong thư mục sang định dạng chuẩn hóa.
– Chuyển tên tệp sang chữ thường.
– Xóa dấu tiếng Việt (ví dụ: _Hà Nội_ thành _Ha Noi_).
– Loại bỏ dấu câu (ví dụ: _tệp,này!.txt_ thành _tep-nay.txt_).
– Thay khoảng trắng bằng dấu gạch ngang (ví dụ: _tệp của tôi.txt_ thành _tep-cua-toi.txt_).
## Flow thao tác
1. Chạy tập lệnh: Thực thi tập lệnh trong terminal hoặc command prompt.
2. Nhập đường dẫn thư mục: Nhập đường dẫn đến thư mục chứa các tệp cần đổi tên. Nhập 0 để thoát.
3. Đổi tên tự động: Tập lệnh xử lý tất cả tệp trong thư mục, áp dụng các quy tắc đổi tên.
4. Xem kết quả: Tập lệnh hiển thị tên cũ và mới của mỗi tệp cùng tóm tắt số lượng tệp đã xử lý.
Ví dụ sử dụng trong terminal:
```
python rename_files.py
```
Ví dụ tương tác:
```
Vui lòng nhập đường dẫn thư mục (0 để thoát): D:\MyFolder
Đang xử lý…
Đã đổi tên: My File!.txt → my-file.txt
Đã đổi tên: Hà Nội_Document.pdf → ha-noi-document.pdf
Đã xử lý 2/2 tệp.
```
## Liên hệ & Hỗ trợ
Email: info@nhavan.vn.
Website: nhavan.vn.
Nếu bạn có câu hỏi hoặc đề xuất, đừng ngần ngại liên hệ để được hỗ trợ nhanh nhất.
Đừng quên star repository này nếu bạn thấy nó hữu ích.