Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Senjar Automation Scripts

A professional collection of Python automation scripts designed to streamline repetitive tasks. Features robust error handling, comprehensive logging, and easy configuration management.

Features

✅ File Organizer - Automatically categorizes and sorts files by type
✅ Email Automation - Send bulk emails with attachments
✅ Web Scraper - Extract data from websites and save to CSV
✅ Error Handling - Comprehensive try-catch blocks
✅ Logging - Detailed operational logs for debugging
✅ Environment Configuration - Use .env files for sensitive data

Project Structure

Senjar-Automation-Scripts/
├── scripts/
│   ├── file_organizer.py      # File organization utility
│   ├── auto_email.py          # Email automation tool
│   └── web_scraper.py        # Web scraping utility
├── examples/               # Example outputs
├── requirements.txt        # Python dependencies
├── .env.example            # Environment variables template
├── .gitignore              # Git ignore rules
├── README.md              # This file
└── LICENSE                # MIT License

Installation

  1. Clone the repository:

    git clone https://github.com/senjarahmad/Senjar-Automation-Scripts.git
    cd Senjar-Automation-Scripts
  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with your settings

Usage

File Organizer

Automatically sort files into folders by type (Images, Documents, Videos, etc.).

python scripts/file_organizer.py

Configuration: Edit ORGANIZE_FOLDER in the script or set ORGANIZE_FOLDER environment variable.

Auto Email

Send emails to multiple recipients with attachments.

python scripts/auto_email.py

Setup:

  • Set SENDER_EMAIL and SENDER_PASSWORD in .env
  • For Gmail, use App Passwords
  • Update recipient list and email content in the script

Web Scraper

Scrape website content and save to CSV.

python scripts/web_scraper.py

Output: Generates timestamped CSV files in the examples/ directory

Scripts Overview

1. file_organizer.py

Purpose: Organize downloads and desktop files into categorized folders

Improvements:

  • Handles duplicate filenames automatically
  • Comprehensive error logging
  • Skips directories (only processes files)
  • Support for 50+ file types

2. auto_email.py

Purpose: Send bulk emails with attachments

Security Features:

  • Uses environment variables (not hardcoded credentials)
  • OAuth-ready structure
  • Proper error handling for authentication failures

Class-based Design:

  • EmailSender class for reusable email functionality
  • Supports both single and bulk email sending

3. web_scraper.py

Purpose: Extract article data from websites

Features:

  • Custom user-agent headers
  • Request timeout handling
  • Absolute URL conversion
  • Timestamped CSV output
  • Error resilience

Dependencies

  • beautifulsoup4 - Web scraping
  • requests - HTTP requests
  • python-dotenv - Environment variable management

See requirements.txt for exact versions.

Configuration

Environment Variables (.env)

# Email Configuration
SENDER_EMAIL=your_email@gmail.com
SENDER_PASSWORD=your_app_password

# File Organizer
ORGANIZE_FOLDER=./Downloads

# Web Scraper
SCRAPE_URL=https://news.ycombinator.com/

Code Quality

  • Type hints for better IDE support
  • Comprehensive docstrings
  • PEP 8 compliant
  • Error handling at every step
  • Logging for debugging

Best Practices Implemented

✅ Error handling with try-except blocks
✅ Logging instead of print statements
✅ Configuration through environment variables
✅ Type hints for better code clarity
✅ Docstrings for all functions
✅ Duplicate file handling
✅ Class-based architecture
✅ Resource cleanup (context managers)

Security Notes

  • Never commit .env files with real credentials
  • Use app passwords for Gmail (not your main password)
  • Keep dependencies updated: pip install --upgrade -r requirements.txt

Performance

  • File Organizer: Handles 1000+ files efficiently
  • Email Sender: Rate-limited to avoid blocking
  • Web Scraper: Includes timeouts to prevent hanging

License

MIT License - See LICENSE file for details

Author

Junayead Ahmad Senjar (@senjarahmad)
Full-Stack Developer | Automation Enthusiast

Contributing

Fork this repository and submit pull requests for improvements.

Support

For issues and questions, please create a GitHub issue.


Last Updated: January 2026
Status: Active Development

About

A collection of Python automation scripts for file organization, email automation, and web scraping. Features error handling, logging, and configuration management.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages