Skip to content

roryrjb/emv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emv

A Python re-write of vimv — bulk rename files by editing their names in your preferred text editor.

Installation

pip install .

Or install in development mode:

pip install -e .

Usage

Basic — rename files in the current directory

emv

This lists all files in the current directory. Edit the names in your editor, save, and close. emv renames each file whose name changed.

Rename specific files

emv file1.txt file2.txt image.png

Only the specified files are shown for renaming.

Recursive mode

emv -r

Walks the full directory tree and lists all files with their relative paths. Renaming a path can also move a file into a different directory.

Example workflow

$ ls
photos/
  001.jpg
  002.jpg
  003.jpg

$ emv photos/*.jpg
# Editor opens with:
#   photos/001.jpg
#   photos/002.jpg
#   photos/003.jpg

# Edit to:
#   photos/vacation_001.jpg
#   photos/vacation_002.jpg
#   photos/vacation_003.jpg

# Save & close → output:
# 3 files renamed.

If you add or remove lines (so the number of names doesn't match the original), the operation is aborted with a warning. If a destination file already exists, that file is skipped.

Editor selection

By default, emv opens Notepad. To use a different editor, set the EDITOR environment variable:

# VS Code (wait flag so the CLI waits for you to close the tab)
set EDITOR=code -w
emv

# Vim
set EDITOR=vim
emv

# Editor with a quoted path containing spaces
set EDITOR="C:\Program Files\Notepad++\notepad++.exe" -multiInst
emv

The value of EDITOR is parsed safely to handle quoted paths and command-line flags.

About

Edit file names with your editor (a reimplementation of vimv in Python for Windows)

Topics

Resources

Stars

Watchers

Forks

Contributors