Skip to content

Temporary file/directory renaming utility for Windows with symlink and UNC path support

License

Notifications You must be signed in to change notification settings

DazzleTools/temp-renamer

Repository files navigation

Temp-Renamer

A helpful Windows utility for temporarily renaming files and directories (including symlinks) to enable operations such as 'git pull' without conflicts, then restoring the original names. Features full support for UNC paths, network shares, and subst drives.

Features

  • Temporary Renaming: Safely rename files/directories with .temp_rename suffix
  • Symlink Support: Handle symbolic links with configurable behavior
  • UNC Path Support: Full support for network paths and mapped drives with UNCtools.
  • Backup & Restore: JSON-based mapping for reliable restoration
  • Progress Tracking: Real-time progress reporting for large operations
  • Conflict Resolution: Smart handling of naming conflicts
  • Cross-Platform: Designed for Windows with network share support

Installation

# Clone the repository
git clone https://github.com/djdarcy/temp-renamer.git
cd temp-renamer

# Install dependencies (if any)
pip install -r requirements.txt

Usage

Basic Commands

  1. Temporarily rename problematic symlink directories:

    python temp_renamer.py -i "C:\myproject\models" -d 0 --mode rename --file-type symlink_directory
  2. Restore original names:

    python temp_renamer.py -i "C:\myproject\models" -d 0 --mode restore --file-type symlink_directory
  3. Full restore (if multiple renames occurred):

    python temp_renamer.py -i "C:\myproject\models" -d 0 --mode restore --full-restore --file-type symlink_directory

Command Line Options

  • --yes: Automatically confirm prompts
  • --quiet: Suppress non-essential output
  • --debug-symlinks: Print extra debug info for symlink resolution
  • --rename-link {self,target}: Choose whether to rename symlink or target
  • --allow-multiple: Allow multiple renamings of already renamed items

Example Use Case

Perfect for AI model directories where symlinks cause git conflicts:

# Create symlinks (example from test-create.bat)
mklink /D checkpoints "c:\models\Stable-diffusion"
mklink /D vae "c:\models\VAE"
mklink /D loras "c:\models\Lora"
mklink /D controlnet "c:\models\ControlNet"

# Before git pull, temporarily rename
python temp_renamer.py -i . -d 0 --mode rename --file-type symlink_directory

# Do your git operations
git pull

# Restore original names
python temp_renamer.py -i . -d 0 --mode restore --file-type symlink_directory

Configuration

The tool uses JSON files to store rename mappings:

  • rename_mapping.json: Current mapping of renamed items
  • config/: Directory for persistent configuration

Contributing

Contributions are welcome! See CONTRIBUTING.md for development setup and guidelines. Please feel free to open issues or submit pull requests.

Like the project?

"Buy Me A Coffee"

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Author

Copyright (C) 2025 Dustin Darcy - ScarcityHypothesis.org

Acknowledgments

Special thanks to the AI/ML community for inspiring this tool's creation to handle model directory symlinks.

About

Temporary file/directory renaming utility for Windows with symlink and UNC path support

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published