Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Created May 25, 2026 20:44
Show Gist options
  • Select an option

  • Save copyleftdev/9bef7774a64846eec82f8032f545b95d to your computer and use it in GitHub Desktop.

Select an option

Save copyleftdev/9bef7774a64846eec82f8032f545b95d to your computer and use it in GitHub Desktop.
vidir — rename or delete a batch of files in your text editor
# vidir — edit a directory listing in $EDITOR (from moreutils)
# sudo apt install moreutils
vidir directory/ # open all files in editor
ls *.sh | vidir - # open a specific subset
# In your editor:
# - Edit a path → renames the file
# - Delete a line → deletes the file
# - Change directory prefix → moves the file
# - :%s/old-/new-/g → bulk rename all matching files
# Replaces:
# rename 's/pattern/replacement/' * (requires remembering Perl regex)
# for f in *; do mv "$f" "new-$f"; done (requires careful quoting)
# With: open editor, edit text, save.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment