LinuxCommandLibrary

vidir

Edit filenames in a text editor

TLDR

Edit filenames in editor

$ vidir
copy
Edit specific files
$ vidir [*.txt]
copy
Edit directory contents
$ vidir [path/to/directory/]
copy
Use specific editor
$ EDITOR=[vim] vidir
copy
Verbose mode
$ vidir -v
copy

SYNOPSIS

vidir [-v] [files|directory]

DESCRIPTION

vidir opens a list of filenames in a text editor, where each line contains a number and a filename. Editing the filenames renames the corresponding files, and deleting lines removes them. All changes are applied when you save and quit the editor.
This approach leverages familiar editor features like search-and-replace, macros, and multi-cursor editing for powerful batch renaming operations that would be tedious with individual mv commands.

PARAMETERS

-v, --verbose

Verbose output.
files
Files to edit.
directory
Directory to edit.

ENVIRONMENT

EDITOR - Editor to use
VISUAL - Visual editor

EXAMPLE

Editor shows:

$ 1 file1.txt
2 file2.txt
3 old_name.doc
copy
Edit to:
$ 1 document1.txt
2 document2.txt
3 new_name.doc
copy

CAVEATS

Part of moreutils package. Careful with deletions. Test on copies first.

HISTORY

vidir is part of moreutils by Joey Hess. It provides intuitive file renaming using familiar editor interfaces.

SEE ALSO

qmv(1), rename(1), mmv(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard