lr-rename-replace 2025.12.30.415

lr-rename-replace

NuGet

A command-line tool for bulk-renaming projects. It renames folders, files, and text content in one go. Unlike simple search-and-replace scripts, it processes directories from the inside out, ensuring that deep project hierarchies are renamed safely without breaking any paths.

Usage

Run it directly with dnx:

dnx -y lr-rename-replace <directory> <old@new> [another-old@another-new]

Examples

Rename a project and its namespace:

dnx -y lr-rename-replace . MyProject@OurProject

Rename multiple things at once:

dnx -y lr-rename-replace ./src "OldApp@NewApp" "v1@v2" "internal@public"

How it works

The tool goes through three steps to make sure nothing gets lost or broken:

  1. Directories first (Inside-Out) It renames folders starting from the deepest ones. This is important because if you rename a parent folder first, the paths to all its sub-folders would change, and the tool wouldn't be able to find them anymore. When a folder is renamed, all its contents are moved to the new location automatically.

  2. File names After folders are handled, it goes through every file and renames it if the filename matches any of your search terms.

  3. Text content Finally, it reads the content of every file and performs the replacements.

    • Binary safety: It checks for null bytes. If it finds 3 or more, it assumes the file is binary (like an image or executable) and leaves it alone.
    • BOM Preservation: If your text files use a UTF-8 BOM (Byte Order Mark), the tool detects it and makes sure it's kept when the file is saved.

Good to know

  • Case Sensitivity: Replacements are case-sensitive. If you need to rename both MyProject and myproject, provide both pairs: MyProject@OurProject myproject@ourproject.
  • Spaces: If your search or replacement strings have spaces, wrap the whole pair in quotes: "Old Name@New Name".
  • Safety: It's always best to run this on a clean git state so you can easily undo the changes if needed.

Installation

If you prefer to have it installed globally on your machine:

dotnet tool install -g lr-rename-replace

Usage after installation:

lr-rename-replace . Old@New

This package has no dependencies.

Version Downloads Last updated
2026.1.29.2106 19 01/29/2026
2026.1.6.2055 50 01/06/2026
2025.12.30.415 9 12/30/2025
2025.12.30.341 3 12/30/2025
2025.12.30.335 2 12/30/2025
2025.12.30.332 2 12/30/2025
2025.12.30.312 3 12/30/2025
2025.12.30.133 12 12/30/2025
2025.12.26.27 5 12/25/2025