rename

Renames multiple files.

Install

All systems
curl cmd.cat/rename.sh
Debian Debian
apt-get install util-linux
Ubuntu
apt-get install util-linux
Alpine
apk add util-linux
Arch Arch Linux
pacman -S util-linux
image/svg+xml Kali Linux
apt-get install util-linux
CentOS
yum install util-linux
Fedora
dnf install util-linux
OS X
brew install rename
Raspbian
apt-get install util-linux
Docker
docker run cmd.cat/rename rename powered by Commando

Renames multiple files.

  • Rename files using a Perl Common Regular Expression (substitute 'foo' with 'bar' wherever found):
    rename 's/foo/bar/' \*
  • Dry-run - display which renames would occur without performing them:
    rename -n 's/foo/bar/' \*
  • Force renaming even if the operation would overwrite existing files:
    rename -f 's/foo/bar/' \*
  • Convert filenames to lower case (use `-f` in case-insensitive filesystems to prevent "already exists" errors):
    rename 'y/A-Z/a-z/' \*
  • Replace whitespace with underscores:
    rename 's/\s+/_/g' \*

© tl;dr; authors and contributors