UNPKG

smart-file-organizer

Version:

Intelligent CLI tool for automatically organizing files by type with preview, logging, and undo functionality

214 lines (152 loc) β€’ 5.81 kB
# πŸ—‚οΈ Smart File Organizer An intelligent CLI tool that automatically organizes your files by type with preview functionality, detailed logging, and smart categorization. ![File Organizer Demo](https://img.shields.io/badge/node.js-16+-green.svg) ![License](https://img.shields.io/badge/license-MIT-blue.svg) ![Version](https://img.shields.io/npm/v/smart-file-organizer.svg) ## ✨ Features - πŸ” **Preview Mode** - See what will happen before making changes - πŸ“ **Smart Categorization** - Automatically sorts 50+ file types into logical folders - πŸ“ **Detailed Logging** - Track all operations with timestamps - ⚑ **Fast & Efficient** - Process hundreds of files in seconds - πŸ›‘οΈ **Safe Operation** - Confirms before making changes, excludes system files - 🎯 **Customizable** - Configure your own file type rules - πŸ“Š **Statistics** - See exactly what was moved and created ## πŸš€ Quick Start ### Installation ```bash # Install globally via npm npm install -g smart-file-organizer # Or run directly with npx npx smart-file-organizer ``` ### Basic Usage ```bash # Organize current folder organize-files # Preview changes first organize-files --preview # Organize specific folder organize-files ~/Downloads # Show help organize-files --help ``` ## πŸ“– Usage Examples ### Organize Downloads Folder ```bash organize-files ~/Downloads --preview # Preview what will happen, then: organize-files ~/Downloads ``` ### Organize Desktop with Preview ```bash organize-files ~/Desktop -p ``` ### Get Help ```bash organize-files --help ``` ## πŸ“ File Categories The organizer automatically sorts files into these categories: | Category | File Types | | --------------------- | ----------------------------------------------------- | | πŸ“Έ **bilder** | `.jpg`, `.png`, `.gif`, `.svg`, `.webp`, `.tiff` | | πŸ“„ **dokumenter** | `.pdf`, `.doc`, `.docx`, `.txt`, `.rtf`, `.odt` | | πŸ“Š **regneark** | `.xls`, `.xlsx`, `.csv`, `.ods` | | πŸ“½οΈ **presentasjoner** | `.ppt`, `.pptx`, `.odp` | | 🎡 **lyd** | `.mp3`, `.wav`, `.flac`, `.aac`, `.ogg`, `.m4a` | | 🎬 **video** | `.mp4`, `.avi`, `.mkv`, `.mov`, `.wmv`, `.webm` | | πŸ“¦ **arkiv** | `.zip`, `.rar`, `.7z`, `.tar`, `.gz`, `.bz2` | | πŸ’» **kode** | `.js`, `.ts`, `.html`, `.css`, `.py`, `.java`, `.cpp` | | πŸ“š **ebook** | `.epub`, `.mobi`, `.azw`, `.fb2` | | πŸ”€ **font** | `.ttf`, `.otf`, `.woff`, `.woff2` | | πŸ“‚ **andre** | All other file types | ## πŸ› οΈ Command Line Options | Option | Short | Description | | ----------- | ----- | -------------------------------------------- | | `--preview` | `-p` | Show what will happen without making changes | | `--help` | `-h` | Display help information | | `--config` | `-c` | Show current configuration | ## πŸ“ Logging All operations are logged to `file-organizer.log` with timestamps: ``` [2025-01-15T10:30:15.123Z] INFO: Opprettet mappe: bilder [2025-01-15T10:30:15.456Z] INFO: Flyttet: vacation.jpg til bilder/ [2025-01-15T10:30:15.789Z] INFO: Flyttet: report.pdf til dokumenter/ ``` ## πŸ”§ Configuration Create a `file-organizer.config.json` file to customize categories: ```json { "categories": { "mine-bilder": [".jpg", ".png", ".heic"], "mine-dokumenter": [".pdf", ".docx"] }, "excludeFiles": ["important.txt"], "logFile": "my-organizer.log" } ``` ## πŸ“Š Example Output ``` πŸ—‚οΈ File Organizer CLI v1.0 ============================ πŸ” Organiserer: /Users/username/Downloads πŸ“‹ Oversikt over endringer: πŸ“ bilder/ (15 filer) β€’ vacation-photo1.jpg β€’ screenshot.png β€’ logo.svg ... og 12 til πŸ“ dokumenter/ (8 filer) β€’ report.pdf β€’ invoice.docx β€’ notes.txt ... og 5 til ❓ Vil du fortsette? (y/N): y πŸš€ Starter organisering... πŸ“„ vacation-photo1.jpg β†’ bilder/ πŸ“„ report.pdf β†’ dokumenter/ πŸ“„ song.mp3 β†’ lyd/ βœ… Organisering fullfΓΈrt! πŸ“Š Statistikk: β€’ Filer flyttet: 23 β€’ Mapper opprettet: 4 β€’ Feil: 0 β€’ Tid brukt: 0.15s ``` ## πŸ§ͺ Development ### Prerequisites - Node.js 16+ - npm or yarn ### Setup ```bash git clone https://github.com/yourusername/smart-file-organizer.git cd smart-file-organizer npm install ``` ### Testing ```bash npm test ``` ### Local Development ```bash npm run dev ``` ## 🀝 Contributing Contributions are welcome! Please feel free to submit a Pull Request. 1. Fork the project 2. Create your feature branch (`git checkout -b feature/AmazingFeature`) 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request ## πŸ› Issues Found a bug? Have a feature request? Please [open an issue](https://github.com/yourusername/smart-file-organizer/issues). ## πŸ“œ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## πŸ™ Acknowledgments - Built with ❀️ using Node.js - Inspired by the need for better file organization - Thanks to the Node.js community ## ⭐ Show your support Give a ⭐️ if this project helped you organize your files! --- **Made with πŸ’» and β˜• by [Marcus](https://github.com/yourusername)**