Skip to content

famyali786-hash/snapshot-Difference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python Streamlit License Live App

πŸ“ File System Snapshot Difference

A Python-based developer tool that captures snapshots of uploaded files and compares them to detect added, modified, and removed files. The project includes a Streamlit web UI for easy interaction and supports both individual file uploads and ZIP folder uploads.

This project was developed as part of an On-the-Job Training (OJT) program to understand file system behavior, hashing, and UI integration using Streamlit.

πŸš€ Live App: https://snapshot-difference-kgankzlgova2faayonisbx.streamlit.app


πŸš€ Features

1. File Snapshot Generation

  • Upload individual files or a ZIP folder
  • Stores file metadata (file path + MD5 hash) in a JSON file
  • Helps track file-level changes across snapshot versions
  • Download snapshots as JSON for permanent storage
  • Import previously saved snapshots

2. Snapshot Comparison (Diff Tool)

Compares Snapshot A and Snapshot B to detect:

  • 🟒 Added Files – Present in Snapshot B but not in Snapshot A
  • 🟑 Modified Files – File content changed (detected via MD5 hash)
  • πŸ”΄ Removed Files – Present in Snapshot A but missing in Snapshot B
  • πŸ“ Line-by-Line Diff – For text files, shows exactly which lines changed

3. Streamlit Web UI

A clean and simple browser-based interface that allows users to:

  • Upload files or ZIP folder β†’ Generate a snapshot
  • Select two snapshots β†’ Compare and view differences
  • View added, modified, and removed files clearly
  • Download and import snapshots for permanent storage

4. Snapshot History Table

Displays all snapshots in a structured table with columns:

  • Snapshot Name
  • Date & Time
  • Number of files in the snapshot
  • Download button (⬇️)
  • Delete button (πŸ—‘οΈ)

5. Live Stats in Sidebar

The sidebar shows real-time statistics:

  • πŸ’Ύ Total snapshots saved
  • πŸ“„ Total files tracked
  • πŸ• Last snapshot date

6. Compare Files

Directly upload two versions of the same file to:

  • Check if files are identical or modified
  • View MD5 hash and file size comparison
  • See line-by-line diff for text files

πŸ—‚οΈ Project Structure

FILE-SYSTEM-SNAPSHOT-DIFFERENCE/
β”‚
β”œβ”€β”€ folder/                 # Sample folder for testing
β”‚
β”œβ”€β”€ snapshots/              # Auto-generated snapshot JSON files
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ diff.py             # Snapshot comparison logic
β”‚   β”œβ”€β”€ file_compare.py     # File comparison logic
β”‚   β”œβ”€β”€ main.py             # CLI text-based menu interface
β”‚   └── snapshot.py         # Snapshot generation logic
β”‚
β”œβ”€β”€ app.py                  # Streamlit UI entry point
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
└── requirements.txt

πŸ› οΈ Tech Stack

  • Python 3
  • Streamlit
  • JSON
  • Hashlib (MD5)
  • Zipfile
  • OS Module

▢️ How to Run the Project

1. Install Dependencies

pip install -r requirements.txt

2. Run the Streamlit App

streamlit run app.py

🧭 How to Use the Streamlit UI

Step 1: Take a Snapshot

  • Go to Take Snapshot section
  • Choose upload mode: Individual Files or ZIP Folder
  • Upload your files
  • Enter a snapshot name
  • Click πŸ’Ύ Save Snapshot

Step 2: Compare Snapshots

  • Go to Compare Snapshots section
  • Select Snapshot A (older) and Snapshot B (newer)
  • Click πŸ” Compare
  • The UI displays:
    • Added files
    • Modified files (with line-by-line diff for text files)
    • Removed files

Step 3: Compare Files Directly

  • Go to Compare Files section
  • Upload the Old File and New File
  • Click πŸ” Compare Files
  • View status, MD5 hash, size difference, and line diff

Step 4: Manage Snapshots

  • Go to Snapshot History section
  • Download snapshots as JSON (⬇️) for permanent storage
  • Delete snapshots (πŸ—‘οΈ) when no longer needed
  • Import previously downloaded snapshots

πŸ“Œ Example Output

Snapshot Diff

Added Files

  • new_feature.py

Modified Files

  • README.md
  • app.py

Removed Files

  • old_script.py

🎯 Purpose of the Project

This OJT project is designed to help learners understand:

  • How file systems store and update data
  • How hashing helps detect content changes
  • How to build real-world developer tools
  • How to integrate backend logic with a Streamlit web UI
  • How to design clean, professional, and scalable project architecture

🌱 Future Improvements (Optional)

  • Snapshot versioning and tagging
  • Export diff results as PDF/CSV reports
  • UI filters and search for large snapshot histories
  • Support for ignore rules (e.g. skip .pyc files)

⭐ If you found this project useful, consider starring the repository!

About

A Python-based developer tool that captures file snapshots using MD5 hashing and compares them to detect added, modified, and removed files. Built with Streamlit web UI. Supports ZIP upload, line-by-line diff, snapshot history, and file comparison.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages