Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🧹 MacSweep - The Ultimate macOS File Cleanup Wizard
# 🧹 MacSweep - The Ultimate File Cleanup Wizard

A powerful and intelligent command-line utility for finding and cleaning unnecessary files on macOS systems. MacSweep transforms your cluttered Mac into a clean, organized workspace with its smart detection algorithms and safe cleanup operations.
A powerful and intelligent command-line utility for finding and cleaning unnecessary files. Originally built for macOS, MacSweep now includes experimental support for Linux and Windows.

## ✨ Features

Expand All @@ -12,6 +12,7 @@ A powerful and intelligent command-line utility for finding and cleaning unneces
- ⚡ **Fast Scanning**: Efficient directory traversal with configurable depth limits
- 🎨 **Clean Output**: Well-formatted terminal output with progress indicators
- 📊 **Progress Tracking**: Real-time progress bars with ETA for long operations
- 🌐 **Cross-Platform**: Experimental support for Linux and Windows

## Categories Detected

Expand All @@ -21,7 +22,7 @@ A powerful and intelligent command-line utility for finding and cleaning unneces
- **Downloads**: Files in Downloads folder
- **Trash**: Files in Trash/trash folders
- **Development**: `node_modules`, `.git`, `__pycache__`, `.venv`, etc.
- **System**: macOS Library caches and logs
- **System**: System caches and logs (macOS, Linux, Windows)
- **Browser**: Safari, Chrome, Firefox cache and data
- **Large Files**: Files over 100MB
- **Old Files**: Files older than 30 days
Expand Down Expand Up @@ -194,7 +195,7 @@ When you run the script, you'll see:

## System Requirements

- **macOS**: Designed specifically for macOS file structure
- **macOS / Linux / Windows**: Works best on macOS but includes experimental support for Linux and Windows
- **Python 3.6+**: Uses only standard library modules
- **Permissions**: Some system directories may require admin access

Expand Down Expand Up @@ -225,6 +226,7 @@ This project is open source and available under the [MIT License](LICENSE).

## ⚠️ Disclaimer

- Cross-platform features are experimental and may not cover all system locations
While MacSweep is designed to be safe, always:
- Run with `--dry-run` first to preview changes
- Back up important data before running cleanup tools
Expand Down
45 changes: 34 additions & 11 deletions macsweep.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
MacSweep - The Ultimate macOS File Cleanup Wizard
A comprehensive terminal utility for finding and cleaning unnecessary files on macOS
MacSweep - The Ultimate File Cleanup Wizard
Originally built for macOS with experimental support for Linux and Windows.
"""

import os
Expand Down Expand Up @@ -81,6 +81,15 @@ def __init__(self):
'fonts': ['.ttf', '.otf', '.woff', '.woff2', '.eot'],
'other': [] # For unknown formats
}
platform = sys.platform
if platform.startswith("linux"):
self.file_types["system"].extend([".cache", "/var/cache", "/var/log", "/tmp"])
self.file_types["browser"].extend([".config/google-chrome", ".cache/mozilla", ".mozilla/firefox"])
self.file_types["trash"].extend([".local/share/Trash"])
elif platform.startswith("win"):
self.file_types["system"].extend(["AppData\\Local\\Temp", "AppData\\Local\\Microsoft\\Windows\\Caches"])
self.file_types["browser"].extend(["AppData\\Local\\Google\\Chrome", "AppData\\Local\\Mozilla", "AppData\\Local\\Microsoft\\Edge"])
self.file_types["trash"].extend(["$Recycle.Bin"])

def count_files(self, path: str, max_depth: int = 3) -> int:
"""Count total files in directory for progress tracking"""
Expand Down Expand Up @@ -963,7 +972,7 @@ def select_specific_formats(self, format_analysis: Dict[str, Dict[str, List[Tupl

def main():
"""Main application entry point"""
parser = argparse.ArgumentParser(description="MacSweep - The Ultimate macOS File Cleanup Wizard")
parser = argparse.ArgumentParser(description="MacSweep - The Ultimate File Cleanup Wizard (experimental Linux/Windows support)")
parser.add_argument("path", nargs="?", default=os.path.expanduser("~"),
help="Path to scan (default: home directory)")
parser.add_argument("--dry-run", action="store_true",
Expand Down Expand Up @@ -994,7 +1003,7 @@ def main():
print(f"Error: Path '{args.path}' is not a directory.")
sys.exit(1)

print("🧹 MacSweep - The Ultimate macOS File Cleanup Wizard")
print("🧹 MacSweep - The Ultimate File Cleanup Wizard")
print("="*60)
print(f"Scanning: {args.path}")
print(f"Max depth: {args.depth}")
Expand Down Expand Up @@ -1152,13 +1161,27 @@ def main():

if args.quick:
# Quick scan - common cleanup locations
common_paths = [
os.path.expanduser("~/Library/Caches"),
os.path.expanduser("~/Library/Logs"),
os.path.expanduser("~/Downloads"),
os.path.expanduser("~/.cache"),
os.path.expanduser("~/.tmp")
]
if sys.platform.startswith("linux"):
common_paths = [
os.path.expanduser("~/.cache"),
os.path.expanduser("~/.local/share/Trash/files"),
"/var/log",
"/tmp",
os.path.expanduser("~/Downloads")
]
elif sys.platform.startswith("win"):
common_paths = [
os.path.join(os.environ.get("LOCALAPPDATA", ""), "Temp"),
os.path.join(os.environ.get("USERPROFILE", ""), "Downloads")
]
else:
common_paths = [
os.path.expanduser("~/Library/Caches"),
os.path.expanduser("~/Library/Logs"),
os.path.expanduser("~/Downloads"),
os.path.expanduser("~/.cache"),
os.path.expanduser("~/.tmp")
]

scan_results = defaultdict(list)
for path in common_paths:
Expand Down