{"id":30906961,"url":"https://github.com/open-technology-foundation/nukedir","last_synced_at":"2025-09-09T12:07:11.607Z","repository":{"id":280371713,"uuid":"941771232","full_name":"Open-Technology-Foundation/nukedir","owner":"Open-Technology-Foundation","description":"A utility for rapidly deleting extremely large directory trees where standard rm -rf is too slow or inefficient.","archived":false,"fork":false,"pushed_at":"2025-09-01T05:01:06.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-01T05:54:56.974Z","etag":null,"topics":["files-folders"],"latest_commit_sha":null,"homepage":"https://yatti.id/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Open-Technology-Foundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-03T02:47:13.000Z","updated_at":"2025-09-01T05:01:09.000Z","dependencies_parsed_at":"2025-03-03T03:39:21.914Z","dependency_job_id":null,"html_url":"https://github.com/Open-Technology-Foundation/nukedir","commit_stats":null,"previous_names":["open-technology-foundation/nukedir"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Open-Technology-Foundation/nukedir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fnukedir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fnukedir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fnukedir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fnukedir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-Technology-Foundation","download_url":"https://codeload.github.com/Open-Technology-Foundation/nukedir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fnukedir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274292948,"owners_count":25258173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["files-folders"],"created_at":"2025-09-09T12:07:06.864Z","updated_at":"2025-09-09T12:07:11.576Z","avatar_url":"https://github.com/Open-Technology-Foundation.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nukedir\n\nFast Delete Large Directory Trees - Version 3.0.0\n\nA high-performance utility for rapidly deleting extremely large directory trees where standard `rm -rf` is too slow or inefficient. Uses `rsync --delete` from an empty temporary directory for optimal performance.\n\n## Features\n\n- **High-speed deletion** using rsync with empty source directory technique\n- **Filesystem-specific optimizations** automatically detects and optimizes for XFS, Btrfs, ext4, and other filesystems\n- **Safe by default** - dry-run mode enabled by default to preview operations\n- **I/O priority control** with ionice/nice for system load management (levels 0-3)\n- **Timeout capability** to prevent runaway processes (supports minutes/hours notation)\n- **Mount point protection** prevents accidental deletion of mounted filesystems\n- **Memory optimization** automatically drops kernel caches during deletion\n- **Multiple directory support** delete multiple directories in a single command\n- **Wait for rsync** option to queue deletions when other rsync processes are running\n- **Verbose rsync output** optional detailed progress reporting\n\n## Requirements\n\n- **Root privileges** or non-interactive sudo access\n- **rsync** command-line tool\n- **bash** shell (version 4.0+)\n- **ionice** and **nice** (optional, for I/O priority control)\n- **timeout** command (optional, for time limits)\n\n## Installation\n\n### Quick Install (One-liner)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/Open-Technology-Foundation/nukedir/main/install.sh | sudo bash\n```\n\nOr with wget:\n```bash\nwget -qO- https://raw.githubusercontent.com/Open-Technology-Foundation/nukedir/main/install.sh | sudo bash\n```\n\n### Manual Installation\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/Open-Technology-Foundation/nukedir.git\n   cd nukedir\n   ```\n\n2. Run the installer:\n   ```bash\n   sudo ./install.sh\n   ```\n\n### What Gets Installed\n\n- `nukedir` script → `/usr/local/bin/nukedir`\n- Bash completion → `/etc/bash_completion.d/nukedir`\n\n### Uninstall\n\n```bash\nsudo ./install.sh --uninstall\n```\n\n### Verify Installation\n\n```bash\nnukedir --version\n```\n\n## Usage\n\n```bash\nnukedir [OPTIONS] dirname [dirname ...]\n```\n\n### Basic Examples\n\n```bash\n# Dry run (default - shows what would be deleted without actually deleting)\nnukedir /path/to/large/directory\n\n# Actually delete the directory (requires explicit --notdryrun)\nnukedir --notdryrun /path/to/large/directory\n\n# Delete with quiet mode (minimal output)\nnukedir -qN /path/to/directory\n```\n\n### Advanced Examples\n\n```bash\n# Set a 4-hour timeout for extremely large directories\nnukedir -T 4h --notdryrun /path/to/huge/directory\n\n# Use highest I/O priority (1) for faster deletion, verbose rsync output\nnukedir -Nri 1 /path/to/large/directory\n\n# Delete multiple directories with high priority, quiet mode\nnukedir -wqN -i 1 /path/to/backups/2025-06-{01..04}\n\n# Wait for other rsync processes to finish before starting\nnukedir --wait-for-rsync -N /path/to/directory\n\n# Verbose rsync output to monitor progress\nnukedir -rN /path/to/directory\n```\n\n### Command Line Options\n\n| Option | Long Form | Description | Default |\n|--------|-----------|-------------|---------|\n| `-n` | `--dryrun` | Dry run mode (no actual deletion) | **Enabled** |\n| `-N` | `--notdryrun` | Execute actual deletion | Disabled |\n| `-T` | `--timeout N` | Maximum runtime (e.g., 2m, 4h) | No timeout |\n| `-i` | `--ionice 0-3` | I/O priority (0=none, 1=highest, 3=lowest) | 0 |\n| `-w` | `--wait-for-rsync` | Wait for other rsync processes | Disabled |\n| `-r` | `--rsync-verbose` | Extra verbose rsync output | Disabled |\n| `-v` | `--verbose` | Verbose output | **Enabled** |\n| `-q` | `--quiet` | Suppress output (recommended with -N) | Disabled |\n| `-V` | `--version` | Display version and exit | - |\n| `-h` | `--help` | Display help and exit | - |\n\n### Safety Features\n\n- **Default dry-run mode** - Must explicitly use `-N` or `--notdryrun` to delete\n- **Root directory protection** - Cannot run from or target root directory (`/`)\n- **Mount point protection** - Refuses to delete mount points\n- **Directory validation** - Verifies targets exist and are directories\n- **Process warnings** - Warns if other rsync processes are running\n\n## How It Works\n\nnukedir uses an efficient technique for deleting large directory trees:\n\n1. **Creates an empty temporary directory** in `/run` (tmpfs) or `/tmp`\n2. **Uses rsync with --delete** to synchronize the target directory with the empty directory\n3. **Optimizes deletion strategy** based on detected filesystem type:\n   - XFS: Uses `--delete-during` for better performance\n   - Btrfs: Uses `--delete-delay` with `--preallocate`\n   - Others: Uses `--delete-before` with `--no-inc-recursive`\n4. **Clears kernel caches** before and after deletion to free memory\n5. **Removes the empty target directory** after successful deletion\n\nThis approach is significantly faster than `rm -rf` for directories containing millions of files.\n\n## Performance Tips\n\n- **Use ionice level 1** (`-i 1`) for fastest deletion on dedicated systems\n- **Use ionice level 3** (`-i 3`) to minimize impact on other processes\n- **Set appropriate timeouts** (`-T`) for very large directories to prevent hanging\n- **Use quiet mode** (`-q`) with `-N` to reduce output overhead\n- **Consider filesystem type** - XFS and ext4 typically perform better than Btrfs for large deletions\n\n## Troubleshooting\n\n### Common Issues\n\n1. **\"Requires root\" error**: Run with `sudo` or as root user\n2. **\"Cannot execute from root directory\"**: Change to a different directory before running\n3. **\"Cannot delete a mount point\"**: Unmount the filesystem first or delete contents only\n4. **Timeout errors**: Increase timeout value with `-T` option (e.g., `-T 8h`)\n5. **Memory issues**: Script automatically drops caches, but ensure sufficient RAM for rsync\n\n### Testing\n\n```bash\n# Test with dry run (safe)\n./nukedir --dryrun /path/to/test/dir\n\n# Lint check\nshellcheck nukedir\n\n# Performance test with timeout\n./nukedir -T 4h --dryrun /path/to/large/dir\n```\n\n## Contributing\n\nContributions are welcome! Please:\n1. Run `shellcheck` before submitting PRs\n2. Test changes in dry-run mode first\n3. Follow existing code style (2-space indentation, function naming conventions)\n4. Update version number in script header for significant changes\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nPart of the Open Technology Foundation toolkit.\n\n## Warning\n\n⚠️ **This tool is extremely powerful and can permanently delete large amounts of data very quickly. Always use dry-run mode first and double-check your target directories!**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Fnukedir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-technology-foundation%2Fnukedir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Fnukedir/lists"}