UNPKG

empty-folder-manager

Version:

Interactive CLI tool for analyzing and removing empty folders from filesystem with .gitignore support and custom glob patterns

211 lines (163 loc) • 5.46 kB
# šŸ—‚ļø Empty Folder Manager - Web UI A beautiful, modern web interface for the Empty Folder Manager CLI tool. Clean up your filesystem with an intuitive graphical interface! ## Features - šŸŽØ **Beautiful Interface**: Modern, responsive design with smooth animations - šŸ“Š **Real-time Progress**: Live updates during analysis with progress bars - šŸ”§ **Easy Configuration**: Simple forms for path, speed, and filtering options - šŸŽÆ **Advanced Filtering**: Support for .gitignore files and custom glob patterns - šŸ” **Dry Run Mode**: Preview what would be removed before making changes - šŸ“ˆ **Detailed Statistics**: Comprehensive analysis results with folder counts - šŸ’¾ **Persistent Settings**: Your configuration is saved between sessions - šŸ“± **Mobile Friendly**: Responsive design works on all devices ## Quick Start 1. **Install dependencies:** ```bash cd webui npm install ``` 2. **Start the web server:** ```bash npm start ``` 3. **Open your browser:** Navigate to `http://localhost:3000` 4. **Configure and analyze:** - Enter the directory path you want to analyze - Choose your preferred processing speed - Set up filtering options (optional) - Click "Run Analysis" to find empty folders - Review results and remove folders as needed ## Configuration Options ### šŸ“ Directory Path Enter the full path to the directory you want to analyze: - **Linux/Mac**: `/home/user/Documents` or `/Users/user/Documents` - **Windows**: `C:\Users\User\Documents` ### ⚔ Processing Speed Choose from 5 speed presets: - **šŸš€ Turbo**: Fastest processing, no delays - **⚔ Fast**: Quick processing with minimal delays - **🐢 Normal**: Balanced speed and system friendliness (default) - **🌱 Gentle**: Slower processing, easier on your disk - **🐌 Ultra Gentle**: Very slow, maximum safety for old systems ### šŸŽÆ Filtering Options - **GitIgnore Support**: Automatically respect .gitignore files - **Custom Patterns**: Add your own ignore patterns using glob syntax #### Example Custom Patterns: ``` node_modules/ *.log .git/ build/ dist/ temp* !important.log ``` ## API Endpoints The web UI communicates with a REST API: ### `POST /api/analyze` Analyze a directory for empty folders. **Request Body:** ```json { "path": "/path/to/analyze", "speed": "normal", "gitignoreEnabled": true, "customPatterns": ["node_modules/", "*.log"] } ``` **Response:** Streaming JSON with progress updates and final results. ### `POST /api/remove` Remove empty folders (with dry-run option). **Request Body:** ```json { "folders": ["/path/to/empty/folder1", "/path/to/empty/folder2"], "dryRun": false, "speed": "normal" } ``` **Response:** ```json { "removedCount": 5, "errorCount": 0 } ``` ### `GET /api/health` Health check endpoint. **Response:** ```json { "status": "ok", "timestamp": "2024-01-01T12:00:00.000Z" } ``` ## Safety Features - āœ… **Dry Run Mode**: Preview changes before making them - āœ… **Confirmation Dialogs**: Multiple confirmations for destructive actions - āœ… **Real-time Validation**: Path validation before analysis - āœ… **Error Handling**: Graceful handling of permission errors - āœ… **Progress Tracking**: Monitor analysis progress in real-time - āœ… **Persistent Logs**: Activity log shows all operations ## Browser Compatibility - āœ… Chrome 80+ - āœ… Firefox 75+ - āœ… Safari 13+ - āœ… Edge 80+ ## Development ### Project Structure ``` webui/ ā”œā”€ā”€ public/ # Frontend files │ ā”œā”€ā”€ index.html # Main HTML page │ ā”œā”€ā”€ styles.css # CSS styling │ └── app.js # Frontend JavaScript ā”œā”€ā”€ src/ # Backend files │ └── server.js # Express server ā”œā”€ā”€ package.json # Dependencies └── README.md # This file ``` ### Running in Development Mode ```bash cd webui npm install npm run dev ``` The server will start on `http://localhost:3000` with automatic restart on file changes. ## Customization ### Styling Edit `public/styles.css` to customize the appearance. The design uses: - CSS Grid and Flexbox for layout - CSS custom properties for theming - Smooth transitions and animations - Responsive design principles ### Functionality Edit `public/app.js` to modify frontend behavior or `src/server.js` for backend changes. ## Troubleshooting ### Common Issues **"Path does not exist" error:** - Ensure the path is correct and accessible - Check file permissions - Use forward slashes (/) even on Windows **Analysis takes too long:** - Try a faster speed preset - Add more ignore patterns to skip unnecessary directories - Ensure the path isn't too large (like entire system drives) **Server won't start:** - Check if port 3000 is already in use - Ensure Node.js 14+ is installed - Run `npm install` to install dependencies ### Performance Tips - **Large directories**: Start with "Gentle" speed and increase if needed - **Network drives**: Use "Ultra Gentle" for best reliability - **SSD users**: "Turbo" or "Fast" speeds work well - **HDD users**: Stick with "Normal" or "Gentle" speeds ## Contributing Contributions are welcome! The web UI is built with: - **Frontend**: Vanilla JavaScript, CSS3, HTML5 - **Backend**: Node.js, Express.js - **No build process**: Simple, dependency-light architecture ## License MIT License - same as the main Empty Folder Manager project. --- **Enjoy cleaning up your filesystem with style! šŸš€**