A simple Python automation tool developed as part of my CodeAlpha internship.
This project automates the process of organizing image files in a folder.
The program searches for .jpg and .jpeg files and automatically moves them into a separate JPG_Files folder.
This saves time and reduces the need to manually organize image files.
- Automatically finds
.jpgfiles - Automatically finds
.jpegfiles - Creates a
JPG_Filesfolder automatically - Moves image files into the destination folder
- Prevents duplicate files from being overwritten
- Displays the files that were moved
- Shows the total number of files moved
- Handles invalid folder paths
- Informs the user when no image files are found
- Python
osmoduleshutilmodule
- Functions
if / elif / elseforloopinput()print()- Variables
- Lists
- String methods
- File and folder handling
- File extensions
- Conditional statements
Suppose the selected folder contains:
TestFiles/
├── photo1.jpg
├── photo2.jpeg
├── document.pdf
└── notes.txt
After running the program:
TestFiles/
├── document.pdf
├── notes.txt
└── JPG_Files/
├── photo1.jpg
└── photo2.jpeg
The program automatically creates the JPG_Files folder and moves the JPG/JPEG images into it.
You can check by running:
python --versionOpen the project folder containing:
file_organizer.py
README.md
In VS Code, select:
Terminal → New Terminal
python file_organizer.pyWhen prompted, enter the path of the folder you want to organize.
Example:
C:\Users\YourName\Desktop\TestFiles
==================================================
CODEALPHA IMAGE FILE ORGANIZER
==================================================
Enter the folder path: C:\Users\YourName\Desktop\TestFiles
Moved: photo1.jpg
Moved: photo2.jpeg
Successfully moved 2 image file(s).
This project was completed as Task 2: Task Automation with Python Scripts as part of my CodeAlpha internship.
Kashif Khan