This project is a Python-based file automation tool that helps organize files and perform basic file management tasks automatically.
The script can:
- Sort files into folders based on file type
- Rename files in bulk
- Delete empty folders
- Generate logs for all operations
- Handle errors using exception handling
- Python
- os module
- shutil module
- logging module
Files are automatically moved into folders such as:
- Images
- Documents
- Audio
- Videos
- Others
Files inside a folder can be renamed using a custom prefix.
Example:
Before:
report.pdf
notes.txt
After:
project_1.pdf
project_2.txt
The script scans the selected directory and removes folders that do not contain any files.
All operations are recorded in automation.log.
Example:
2026-06-25 18:00:10 - INFO - moved report.pdf to Documents
File-Automation-Script/
│
├── automation.py
├── README.md
├── automation.log
└── sample_test_folder/
- Open the project folder in VS Code.
- Open Terminal.
- Run:
python automation.py- Choose an option from the menu.
1. Sort files
2. Rename files
3. Delete empty folders
4. Exit
Enter choice: 1
Enter path: C:\Users\User\Desktop\sample_test_folder
moved: photo.jpg
moved: report.pdf
moved: song.mp3
Through this project, I learned:
- Working with files and folders using Python
- Using the os module
- Exception handling
- Logging operations
- Creating automation scripts
- Using Git and GitHub for version control
S Mahammad Nadhim