Skip to content

Latest commit

Β 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—ƒοΈ SMARTFIE

Smart File Duplicate Detection & Storage Management System

Find. Analyze. Clean. Recover.

Status Python React SQLite License


πŸ“– About

SMARTFIE is a full-stack, web-based file management and storage optimization system. It scans folders, detects exact duplicate files using SHA-256 hashing, calculates wasted storage, and gives users full control over cleanup β€” with built-in backup and undo support.

Whether files have different names or live in different folders, SMARTFIE identifies them as duplicates the moment their content matches.

Built incrementally β€” every feature is planned, implemented, tested, and documented before moving to the next stage.


πŸ“‘ Table of Contents


🚦 Status

🟑 In Development

The core backend, database, duplicate detection, React dashboard, file classification, cleanup, recovery, dark mode, and documentation features have all been implemented. Additional testing and final documentation are in progress.


πŸ› οΈ Tech Stack

Layer Technology
🐍 Backend Python + FastAPI
πŸ—„οΈ Database SQLite + SQLAlchemy
πŸ” Hashing SHA-256
βš›οΈ Frontend React + CSS
πŸ”— API Communication Axios
πŸ’» Dev Environment VS Code
πŸ”§ Version Control Git + GitHub

✨ Features

πŸ“ Folder scanning πŸ“„ Recursive file scanning πŸ” Exact duplicate detection
πŸ” SHA-256 hashing πŸ’Ύ Wasted storage calculation πŸ“Š Storage statistics dashboard
πŸ—‚οΈ Duplicate file grouping πŸ—ƒοΈ File type classification πŸ–ΌοΈ Duplicate image detection
β˜‘οΈ Individual file selection β˜‘οΈ Select All / Deselect All πŸ—‘οΈ Cleanup selected duplicates
↩️ Undo cleanup πŸ’š Storage recovery tracking πŸ•’ Scan history
πŸ—„οΈ SQLite storage πŸŒ™ Dark mode πŸ“± Responsive dashboard

πŸ—‚οΈ Project Structure

SMARTFIE/
β”‚
β”œβ”€β”€ README.md
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ scanner.py
β”‚   β”œβ”€β”€ hasher.py
β”‚   β”œβ”€β”€ duplicate_finder.py
β”‚   β”œβ”€β”€ database.py
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ create_database.py
β”‚   β”œβ”€β”€ save_scan.py
β”‚   β”œβ”€β”€ check_database.py
β”‚   β”œβ”€β”€ scan_history.py
β”‚   β”œβ”€β”€ test_duplicates.py
β”‚   β”œβ”€β”€ test_hasher.py
β”‚   β”œβ”€β”€ test_scanner.py
β”‚   └── TestFiles/
β”‚
└── frontend/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx
    β”‚   β”‚   └── Dashboard.css
    β”‚   β”œβ”€β”€ api/
    β”‚   β”‚   └── api.js
    β”‚   └── assets/
    β”‚
    β”œβ”€β”€ public/
    └── package.json

πŸ“… Development Progress

Stage 1 β€” Project Setup βœ…
  • Created project structure
  • Created Python virtual environment
  • Installed FastAPI and Uvicorn
  • Created and tested the basic backend
Stage 2 β€” File Scanner βœ…
  • Built a recursive file scanner
  • Scans folders and subfolders
  • Collects file name, path, size, and extension
  • Added file type classification
  • Added folder validation and error handling
  • Added /scan API functionality
Stage 3 β€” Duplicate Detection βœ…
  • Implemented SHA-256 hashing
  • Detects exact duplicate files
  • Groups duplicate files together
  • Calculates potentially wasted storage
  • Added /duplicates API functionality
  • Added duplicate image detection during normal scanning
Stage 4 β€” SQLite Database & Scan History βœ…
  • Added SQLite database using SQLAlchemy
  • Created Scan and File database models
  • Stores scanned file metadata and SHA-256 hashes
  • Maintains scan history
  • Added /history API
  • Tested multiple scan records successfully
Stage 5 β€” React Dashboard βœ…
  • Built the SMARTFIE frontend dashboard
  • Added sidebar navigation, Dashboard and History pages
  • Connected frontend with backend APIs
  • Storage overview: Files Scanned, Duplicate Groups, Wasted Storage, Storage Recovered
  • Storage statistics + usage progress bars
  • File type classification & duplicate group display
  • Displays scanned folder path
  • Responsive layout + dark mode
Stage 6 β€” Duplicate File Cleanup & Recovery βœ…
  • Displays duplicate files in groups (name, path, size)
  • Individual file selection + Select All / Deselect All
  • Clean Selected action with status messages
  • Storage recovery tracking
  • Backup before cleanup + Undo Cleanup functionality
  • Cleanup-related history support
Stage 7 β€” Advanced Features 🟑

Completed

  • Improved cleanup safety
  • File type grouping and filtering
  • Duplicate image detection
  • Cleanup Undo functionality
  • Dark mode

Remaining

  • Scan progress indicator
  • Further error handling improvements
  • Search and filtering
  • Export scan reports
Stage 8 β€” Testing & Final Documentation πŸ”²
  • Complete frontend testing
  • Complete backend testing
  • Test cleanup functionality thoroughly
  • Improve error handling
  • Finalize project documentation
  • Prepare screenshots and project report
  • Prepare final project demonstration

πŸ” How It Works

πŸ“Š Dashboard

The SMARTFIE dashboard provides an overview of the latest scan, displaying total files scanned, duplicate groups, wasted storage, storage recovered, waste analysis, file type categories, duplicate file groups, and the scanned folder path.

πŸ“ Folder Scanning

Users provide a folder path, and SMARTFIE recursively scans that folder and its subfolders. For each file it collects the name, path, size, extension, type, and SHA-256 hash β€” then displays the results on the dashboard.

πŸ” Duplicate Detection

Each file's content is hashed using SHA-256. Files that produce the same hash are grouped as duplicates β€” regardless of file name or location.

photo1.png
photo1_copy.png

If both files contain exactly the same data, they produce the same hash and are flagged as duplicates.

πŸ—ƒοΈ File Classification

Scanned files are automatically classified by extension into:

Images Β· Documents Β· Videos Β· Audio Β· Other

πŸ—‘οΈ Duplicate File Management

Duplicate groups show file name, path, and size. Users can select individual files, select/deselect all, and clean selected files β€” nothing is removed automatically, keeping cleanup fully user-controlled.

↩️ Cleanup and Recovery

Before removing a file, SMARTFIE creates a backup copy, then removes the original and tracks recovered storage. The Undo Cleanup feature restores files from backup at any time.

πŸ•’ History

Scan and cleanup activity is stored in the SQLite database, letting users review past operations at any time.


πŸ“‘ API Endpoints

Method Endpoint Description
GET / Health check / root endpoint
GET /scan Scan a folder for files
GET /duplicates Detect duplicate files
GET /history View scan history
DELETE /cleanup Remove a selected duplicate file
POST /undo-cleanup Restore files removed during cleanup

Interactive API Docs: once the backend is running, Swagger UI is available at http://127.0.0.1:8000/docs


πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/aishwar-ya/SmartFile.git
cd SmartFile

🐍 Backend Setup

cd backend

# Create virtual environment
python -m venv venv

# Activate it
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install fastapi uvicorn sqlalchemy

# Start the backend
uvicorn main:app --reload
  • Backend runs at: http://127.0.0.1:8000
  • Swagger docs at: http://127.0.0.1:8000/docs

βš›οΈ Frontend Setup

Open a new terminal:

cd SmartFile/frontend
npm install
npm run dev

Then open the local URL shown in your terminal. πŸŽ‰


πŸ§ͺ Testing

The backend includes dedicated test files for core components:

backend/
β”œβ”€β”€ test_duplicates.py
β”œβ”€β”€ test_hasher.py
└── test_scanner.py

A dedicated test folder supports duplicate detection and classification testing:

TestFiles/
β”œβ”€β”€ Images/
β”œβ”€β”€ Documents/
β”œβ”€β”€ Videos/
β”œβ”€β”€ Audio/
└── Other/

πŸŽ“ What I've Learned

Backend

  • Python programming
  • Virtual environments
  • FastAPI & REST API design
  • Recursive file scanning
  • SHA-256 hashing
  • Duplicate detection logic

Database

  • SQLite
  • SQLAlchemy
  • Database models & relationships
  • Scan history management

Frontend & Workflow

  • React & state management
  • Dashboard development
  • File selection interfaces
  • Cleanup & recovery flows
  • Git & GitHub workflow
  • Full-stack development

πŸ“Œ Current Development Status

βœ… Completed

Backend setup Β· Recursive scanning Β· SHA-256 hashing Β· Duplicate detection Β· Wasted storage calculation Β· SQLite integration Β· Scan history Β· React dashboard Β· Storage statistics Β· File classification Β· Duplicate image detection Β· Duplicate file interface Β· File selection Β· Select All / Deselect All Β· Cleanup interface Β· Cleanup backup Β· Undo cleanup Β· Storage recovery tracking Β· History interface Β· Dark mode Β· Responsive dashboard

πŸ”œ Next

  • Scan progress indicator
  • Additional error handling
  • Search and filtering
  • Export scan reports
  • Additional testing
  • Final documentation
  • Project report
  • Final presentation & demonstration

πŸ“ Development Notes

SMARTFIE is developed incrementally. Each major feature is planned β†’ implemented β†’ tested β†’ improved β†’ documented, keeping the project organized from start to finish.


πŸ“„ License

This project is currently unlicensed. A license such as MIT may be added before public release.

About

Smart file duplicate detection & storage optimization system built with FastAPI, React, and SHA-256 hashing. Scan folders, find duplicates, clean up safely with backup & undo.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages