prename

Rename multiple files. NOTE: this page refers to the command from the prename Fedora package. More information: <https://manned.org/man/prename>.

Install

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

Rename multiple files. NOTE: this page refers to the command from the prename Fedora package. More information: <https://manned.org/man/prename>.

  • 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 remove existing destination 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