File and Directory Renaming
In addition to replacing text within files, Renamify can rename files and directories that match your pattern.
What Gets Renamed
Section titled “What Gets Renamed”Any file whose name contains your search pattern will be renamed:
getUserName.js
→fetchUserProfile.js
get_user_name.py
→fetch_user_profile.py
GetUserName.tsx
→FetchUserProfile.tsx
Directories
Section titled “Directories”Directory names are also transformed:
user-name/
→user-profile/
getUserName/
→fetchUserProfile/
Rename Order
Section titled “Rename Order”Renamify renames in dependency order:
- Files first
- Then directories, deepest first This prevents conflicts and ensures all operations succeed.
Root Directory Renaming
Section titled “Root Directory Renaming”NEW: Renamify can now rename the project root directory itself when the directory name matches your pattern.
Safety First
Section titled “Safety First”- Default behavior: Root directory renaming is disabled for safety
- Enable with
--rename-root
: Explicitly allow root directory renaming - Manual confirmation: Always requires interactive confirmation
- Next steps snippet: Provides instructions for rebuilding/reloading after root rename
Example
Section titled “Example”# This will offer to rename the project directory itselfcd /path/to/renamify-projectrenamify rename renamify renamed_renaming_tool --rename-root
Renamify will show a “Next Steps” snippet like:
Next Steps:1. cd ../renamed-renaming-tool-project2. cargo build --release # if Rust project3. Update any IDE project settings
Safety Considerations
Section titled “Safety Considerations”- Always commit changes before root directory rename
- Update build scripts, IDE settings, and documentation paths
- Consider impact on CI/CD pipelines that reference the directory name
Controlling Rename Behavior
Section titled “Controlling Rename Behavior”Disable File Renaming
Section titled “Disable File Renaming”renamify rename old_name new_name --no-rename-files
Disable Directory Renaming
Section titled “Disable Directory Renaming”renamify rename old_name new_name --no-rename-dirs
Prevent Root Directory Renaming
Section titled “Prevent Root Directory Renaming”renamify rename old_name new_name --no-rename-root
Examples
Section titled “Examples”Basic File Renaming
Section titled “Basic File Renaming”renamify rename getUserName fetchUserProfile
Might show:
Files to rename: 3┌─────────────────────────────────────┬─────────────────────────────────────┐│ Current Path │ New Path │├─────────────────────────────────────┼─────────────────────────────────────┤│ src/getUserName.js │ src/fetchUserProfile.js ││ components/GetUserName.tsx │ components/FetchUserProfile.tsx ││ tests/get_user_name.test.py │ tests/fetch_user_profile.test.py │└─────────────────────────────────────┴─────────────────────────────────────┘
Project-Wide Rename
Section titled “Project-Wide Rename”renamify rename myproject awesome_project --rename-root
This could rename:
- The root directory:
myproject/
→awesome_project/
- Files:
myproject.config.js
→awesome_project.config.js
- Directories:
src/myproject/
→src/awesome_project/
- Content references within files
Conflict Detection
Section titled “Conflict Detection”Renamify detects several types of renaming conflicts:
Multiple-to-One Conflicts
Section titled “Multiple-to-One Conflicts”When multiple files would be renamed to the same destination:
❌ Error: Multiple files would be renamed to 'utils.js': - old_utils.js - oldUtils.js
Case-Insensitive Filesystem Conflicts
Section titled “Case-Insensitive Filesystem Conflicts”On macOS and Windows (case-insensitive filesystems):
⚠️ Warning: Renaming 'OldName.js' to 'oldName.js' requires special handling
Renamify uses two-step renames for case-only changes:
OldName.js
→temp_12345.js
temp_12345.js
→oldName.js
Windows Reserved Names
Section titled “Windows Reserved Names”Prevents creating files with Windows reserved names:
❌ Error: Cannot create file 'CON.js' (Windows reserved name)
Platform Compatibility
Section titled “Platform Compatibility”Unix Systems (Linux, macOS)
Section titled “Unix Systems (Linux, macOS)”- Handles case-sensitive and case-insensitive filesystems
- Supports long file paths
- Preserves file permissions
Windows
Section titled “Windows”- Handles path length limitations (260 chars)
- Prevents reserved filenames (CON, PRN, AUX, etc.)
- Supports both forward and backward slashes
Symbolic Links
Section titled “Symbolic Links”- Symlink files can be renamed if their names match
- Symlink targets are never modified
- By default, symlinks are not followed during traversal