A lightweight Python Command Line Interface (CLI) application that recursively scans directories or local drives (e.g., C:\) to categorize and report file distribution statistics based on extension types.
-
📁 Recursive drive and directory scanning using Python's
os.walk -
🏷️ Automatic file categorization (Images, Documents, Videos, Audio, Archives, Code, Others)
-
🔍 File extension classification matching over 30+ popular file extensions
-
🙈 Automatic exclusion of hidden system files (files starting with
.) -
📊 Comprehensive console output summarizing category counts and total file counts
-
⚡ Memory-efficient execution suitable for large disk volumes
-
Python 3
-
os(Standard Library) -
Git & GitHub
File-System-Analyzer/
│
├── analyzer.py (or main.py)
├── README.md
├── .gitignore
└── venv/
Note:
venv/should not be uploaded to GitHub.
The script follows a systematic process to scan and analyze your storage system:
-
The user launches the application and specifies a target path or drive directory (defaults to
C:\). -
The script checks for path existence using
os.path.exists(). -
The scanner walks recursively through the file system using
os.walk(). -
Hidden files (starting with
.) and extensionless files are filtered out. -
Extracted file extensions are normalized to lowercase using
os.path.splitext(). -
Extensions are mapped against predefined category dictionaries (Images, Documents, Videos, Audio, Archives, Code).
-
Files not matching known categories are grouped into an
Othersbucket. -
Aggregated file totals and category counts are formatted and displayed in the terminal.
The script scans and organizes files across these categories:
-
Images:
.jpg,.jpeg,.png,.gif,.bmp,.svg,.webp -
Documents:
.pdf,.docx,.doc,.txt,.xlsx,.pptx,.csv -
Videos:
.mp4,.mkv,.avi,.mov,.flv,.wmv -
Audio:
.mp3,.wav,.aac,.flac,.m4a -
Archives:
.zip,.rar,.7z,.tar,.gz -
Code:
.py,.html,.css,.js,.json,.java,.cpp -
Others: Any extension not explicitly defined in the above categories
The .gitignore file should contain:
venv/
__pycache__/
*.pyc
.DS_Store
git clone https://github.com/ayasreebiswas-cmd/File-System-Analyzer.git
cd File-System-Analyzer
On Windows:
python -m venv venv
On Windows:
venv\Scripts\activate
On macOS/Linux:
source venv/bin/activate
Ensure Python is installed, then execute the script from your terminal:
python analyzer.py
Scanning drive (C:\)... This may take a few minutes.
--- File Summary ---
Images : 1420
Documents : 850
Videos : 64
Audio : 310
Archives : 45
Code : 612
Others : 230
--------------------
Total files found: 3531
After making changes to the project:
git status
git add .
git commit -m "Update project"
git push
Possible future improvements include:
- Interactive command line arguments (e.g., passing custom scan paths via
argparse) - File size calculation (e.g., total MB/GB consumed per category)
- Exporting scan reports to CSV, JSON, or HTML formats
- Multi-threading support to accelerate scanning across large SSDs and HDDs
- Duplicate file detection based on file hashing (MD5/SHA256)
Ayasree Biswas
This project is intended for educational and project-development purposes.