Skip to content

zerx-lab/rmx

Repository files navigation

 ██████╗ ███╗   ███╗██╗  ██╗
 ██╔══██╗████╗ ████║╚██╗██╔╝
 ██████╔╝██╔████╔██║ ╚███╔╝ 
 ██╔══██╗██║╚██╔╝██║ ██╔██╗ 
 ██║  ██║██║ ╚═╝ ██║██╔╝ ██╗
 ╚═╝  ╚═╝╚═╝     ╚═╝╚═╝  ╚═╝

rmx

⚡ Fast Parallel Deletion for Windows

Quickly delete files, folders, and resolve file locking issues at blazing speed

License Windows Rust

English | 简体中文


✨ Performance

Benchmark on 5,301 items (5,000 files, 301 directories):

Method Time vs rmx
⚡ rmx 514ms 1.00x
PowerShell Remove-Item 1,150ms 2.2x slower

🚀 Key Features

Feature Description
📁 Files & Folders Delete individual files, directories, and batch deletions seamlessly
🔥 POSIX Delete Uses FILE_DISPOSITION_POSIX_SEMANTICS for immediate namespace removal
Parallel Multi-threaded workers with dependency-aware scheduling
🎯 Direct API Bypasses high-level abstractions using native Windows API
📏 Long Paths Handles paths >260 characters with \\?\ prefix
🔄 Auto Retry Exponential backoff for locked files
🔓 Delete Locked Items Terminate processes locking files/directories and delete them with --kill-processes
🔓 Unlock Items Unlock files/directories by closing handles and terminating locking processes without deletion using --unlock

📦 Installation

Scoop (Recommended)

# Add the rmx bucket
scoop bucket add rmx https://github.com/zerx-lab/rmx

# Install
scoop install rmx

Cargo

# Install from GitHub
cargo install --git https://github.com/zerx-lab/rmx

# Or install from local source
cargo install --path .

Manual Download

Download the latest release from GitHub Releases.

🔄 Update

# Self-upgrade (recommended)
rmx upgrade

# Only check for updates
rmx upgrade --check

# Force upgrade, bypass package manager detection
rmx upgrade --force

Or update via your package manager:

# Scoop
scoop update rmx

# Cargo
cargo install --git https://github.com/zerx-lab/rmx --force

📖 Usage

Delete Directories

# Delete a single directory
rmx ./node_modules

# Delete multiple directories at once
rmx ./target ./node_modules ./dist

# Recursively delete directory and contents
rmx -r ./build_output

Delete Files

# Delete a single file
rmx ./log.txt

# Delete multiple files
rmx ./file1.txt ./file2.log ./cache.db

Delete Locked Files or Directories

# Terminate processes locking files/directories and delete them
rmx --kill-processes ./locked_directory

# Force termination, recursive deletion with locking process cleanup
rmx -rf --kill-processes ./path

Unlock Files or Directories (Without Deleting)

# Only unlock a file without deleting it
rmx --unlock ./locked_file.txt

# Unlock a directory without deleting it
rmx --unlock ./locked_directory

# Unlock with verbose output to see process details
rmx --unlock -v ./path

Preview & Safety

# Dry run (preview what would be deleted without actually deleting)
rmx -n ./node_modules

# Verbose mode with detailed statistics
rmx -v --stats ./target

# Force deletion (skip confirmation prompt)
rmx --force ./path

Self Upgrade

# Upgrade to the latest version
rmx upgrade

# Only check if a new version is available
rmx upgrade --check

# Force upgrade, bypass package manager detection
rmx upgrade --force

rmx auto-detects the installation method (Scoop, Cargo, npm). For manual installations, it downloads the latest release from GitHub and replaces the binary in-place.

Shell Extension

Initialize rmx shell extension for Windows Explorer right-click menu:

# Initialize shell extension (install or reinstall)
rmx init

After initialization, right-click any file or folder to see "Delete with rmx" option.

Note: Run PowerShell or CMD as Administrator for the init command.

⚙️ Options

Option Description
-r, -R, --recursive Remove directories and their contents recursively
-f, --force Force deletion without confirmation
-t, --threads <N> Number of worker threads (default: CPU count)
-n, --dry-run Scan but don't delete
-v, --verbose Show progress and errors
--stats Show detailed statistics
--no-preserve-root Do not treat '/' specially
--kill-processes Terminate processes locking files/directories, then delete them
--unlock Only unlock files/directories (close handles) without deleting

Subcommands

Subcommand Description
init Initialize shell extension (Windows Explorer right-click menu)
uninstall Remove shell extension and context menu handler
upgrade Upgrade rmx to the latest version from GitHub Releases
upgrade --check Only check for updates without installing
upgrade --force Force upgrade, bypass package manager detection

🛡️ Safety Features

Protection Description
🚫 System directories Cannot delete C:\Windows, C:\Program Files, etc.
🏠 Home directory Cannot delete user's home directory
📂 Current directory Warns when deleting CWD or its parents
✅ Confirmation Asks for confirmation by default (use -f to skip)

🔧 Technical Details

Windows API Usage

  • CreateFileW with FILE_SHARE_DELETE for non-blocking access
  • SetFileInformationByHandle with FILE_DISPOSITION_INFORMATION_EX
  • FILE_DISPOSITION_POSIX_SEMANTICS for immediate removal
  • FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE for read-only files
  • FindFirstFileExW / FindNextFileW for fast enumeration

File Lock Handling

When a file is locked by another process:

  1. Retry up to 10 times with exponential backoff (10ms → 100ms)
  2. If still locked, record failure and continue with other files
  3. Report all failures at the end

📋 Requirements

  • Windows 10 version 1607 or later
  • NTFS filesystem

📄 License

MIT


⬆ Back to Top

Made with ❤️ for Windows developers

About

⚡ Windows 高性能并行目录删除工具

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages