What is the best way to rename a heap of files?

There are two rename apps

  • a Perl program
  • a utility from util-linux
    You can also use mv in a loop

I have the util-linux version

trinity:[nevj]:~$ rename -V
rename from util-linux 2.41

I used it to do the following

The syntax of that rename version is

rename ' from '  ' to '  files

I have several folders of these image files so I just cd’d around and did each folder by hand.

Just wondering… has anyone used the Perl version of rename or do people do it with the File Manager or some other GUI tool?

I have previously used `mv in a loop… like this

for i in * ; do
  mv “$i” “ren $i”
done

where ren is some program that permutes one name as required.

Any better ideas

2 Likes

ME! I’ve posted previously - probably mostly on that topic I started something like “problem to solve with regex”…

In some places its called “prename” - if you have perl installed - you can get it from CPAN… On Debian based distros - “rename” is Perl Rename - but the “rename” you get by default on RPM based distros like RHEL or CentOs or Fedora - is some other beast… I’ve had to get prename from CPAN in the past when bulk renaming files from a RHEL system.

It’s part of my fundamental CLI toolset…

Uses sed style regex… I also keep a “dictionary” of stuff because regex can be quite unfriendly if you’re wanting to do something more sophisticated than replace one string with another (or remove a specific string from a filename)…

# rename --dry-run 's|(\d+)|sprintf("%05d",$1+5674)|e'
# add "15" onto a digit in the first field : 
rename -n 's|(\d+)|sprintf("%2d",$1+15)|e' *
# remove "()" from string / filename 
rename -n 's/[()]//g' *
# capitalise first character of each word :
rename -n 's/\s(\w)/ \u$1/g' *
...
# Add a string (e.g. "-FLAC") to the end of something
rename -n 's/$/-FLAC/' *

All those examples are using the “dry-run” method - i.e. “-n” - so it just shows what it will do… I’ve made mistakes in the past - so I always test first…

This one : “rename -n 's|(\d+)|sprintf("%2d",$1+15)|e' *” I use reasonably often

e.g. I have two folders of a music album, e.g. CD1, CD2, that’s not all that useful with digital music - I’d rather have them all in the same folder, but not “01 - CD1 - songname.mp3” and “01 - CD2 - songname.mp3” - so - the files from disk 2 - get a number added to the first part of the filename - e.g. there’s 15 songs on CD1, and 12 songs on CD2, so I add 15 onto the numbering format of the files from disk 2 - so “01 - CD2 - songname.mp3” becomes “16 - CD2 - songname.mp3”…

And that way - the tracks sort properly in a filesystem based music player, like Sayonara, or Music Folder Player Full on Android… I detest intermediate media database interference - a filesystem is a perfectly fine database - I don’t want anything else!

I use it constantly - I can’t stand having to escape things - and the fat32 filesystem on the SD-Card in my Samsung phone HATES it when it gets files (I use adb-sync - it’s like rsync for USB transfers to Android) with accented characters (e.g. Umlauts) or things like “&” in a filename…

I used to spend an inordinate amount of time also removing spaces from filenames - but I no longer bother… But - I usually remove spaces from the parent folder of something…

I’ve also previously used (p)rename from find output - e.g. find all mp3 files with the string “- Led Zeppelin -” in them (I keep all my files in artist name parent folders anyway - so don’t need the artist name in the individual file - and that’s also stored in the metadata of each music file) so :

find . -type f -iname \*.mp3 -exec rename 's/Led\ Zeppelin\ -//' {} \; (but be careful - this could destructive or irreversible)… The reason I specify the “-type f” is so that it doesn’t touch folders - it shouldn’t anyway - but I like to be sure… the “//” on the end of the regex just means replace that string with nothing (remove that string).

2 Likes

So Prename ( Perl version) is better than the Linux utility I used.
I know you posted on this several times… my case at moment is simpler than anything you do. I should setup the Perl version.
Thanks

1 Like

Yeah - I believe it’s the default rename command on Debian and Ubuntu and derivatives…

Couldn’t say with Arch based…

RPM based distros “rename” is something else…

Here’s what “rename” looks like on a fairly “generic” Debian Stretch system (Raspbian Stretch on a Pi3) :

╭─x@telesto ~  
╰─➤  which rename
/usr/bin/rename
╭─x@telesto ~  
╰─➤  file /usr/bin/rename
/usr/bin/rename: symbolic link to /etc/alternatives/rename
╭─x@telesto ~  
╰─➤  file /etc/alternatives/rename
/etc/alternatives/rename: symbolic link to /usr/bin/file-rename
╭─x@telesto ~  
╰─➤  file /usr/bin/file-rename
/usr/bin/file-rename: Perl script text executable

Debian does all that by default - i.e. makes /usr/bin/rename a symlink to /etc/alternatives/rename, which is itself a symlink to /usr/bin/file-rename

I’m almost 100% sure I didn’t even have to install it - my O/S “came like that”…

But appears not to be the case with Bullseye - at least the Raspbian version of Bullseye…

There is no “rename” command on my Pi Zero 2W armhf…

But I can easily install it :

x@anthe  ~  sudo apt install rename
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libio-stringy-perl libpod-parser-perl
The following NEW packages will be installed:
  libio-stringy-perl libpod-parser-perl rename
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 171 kB of archives.
After this operation, 449 kB of additional disk space will be used.
Do you want to continue? [Y/n]

and I’m cooking with gas!

I believe the package name in a YUM repo for RHEL, CentOS, Fedora, et cetera, would be “prename” so “yum install prename” or if you’re that way inclined: “dnf install prename:smiley:


Hmmm - prename seems to NOT be on the RHEL 8.10 DVD - just tried to install it and it doesn’t know where or how to find it - so maybe have to go to EPEL to get it?

2 Likes

I was in Artix (Arch based)
It had the linux-utility version by default.
Will try and install the Perl version.

1 Like

I just used it now!

I noticed my FLAC copy of Judas Priest’s “Beyond Live and Rare” had two folders, “CD 1” and “CD 2”…

“CD 1” - the last track is “11” - so

cd ~/MPZ/JudasPriest/2021-BeyondLive-and-Rare-FLAC/CD\ 2
rename 's|(\d+)|sprintf("%2d",$1+11)|e' *

Note - I ran it with “-n” first! And I really have no idea how that works :smiley: (i.e. sprintf("%2d",$1+11) - black magic? )

and the first track / file on CD 2 :

'01 - Tyrant - June 07 1981 - Odessa Tx - Ector County Coliseum.flac'
becomes :
'12 - Tyrant - June 07 1981 - Odessa Tx - Ector County Coliseum.flac'

then

mv *.flac ../.
cd ../CD\ 1
mv *.flac ../.
rm -Rf CD\ 1 CD\ 2
1 Like

Here is what is available in Artix(Arch)

trinity:[nevj]:~$ pacman -Ss rename
world/krename 5.0.2-10
    A very powerful batch file renamer
world/renameutils 0.12.0-7.1
    A set of programs designed to make renaming of files faster and less
    cumbersome

I tried ‘renameutils’ it does nothing
Then Iooked in the AUR

trinity:[nevj]:~$ yay -Ss rename
aur/nmly 1.1.1-1 (+0 0.00) 
    Bulk rename utility with useful functions
aur/subtitle-video-renamer 0.6.0-1 (+0 0.00) 
    Application for renaming videos and subtitles
aur/mkinitcpio-sd-zfs-rename 0.1.0-3 (+0 0.00) 
    This module renames the zfs filesystem declared in (zpool get) bootfs, if the name ends with "_next_boot", by removing the "_next_boot" part from the filesystem name/path
aur/nmly-git 1.1.1.r11.gbdb2577-1 (+0 0.00) 
    Bulk rename utility with useful functions
aur/flut-renamer-bin 1.5.2-12 (+0 0.00) 
    A GUI application written in Flutter (using GTK on Linux), it helps users batch renaming their files in multiple ways, including inserting text, inserting file metadata and Exif data, replacing text, deleting text, rearranging, transliterating characters.
aur/batch-rename 0.1.2-3 (+0 0.00) 
    Command line tool to bulk-rename files interactively
aur/i3icons2-git 20181213.27ee9d8-1 (+0 0.00) 
    go version of i3icons - native deamon to rename workspaces with fontawesome-icons based on open applications
aur/python-renamer 0.0.1-1 (+0 0.00) 
    Python batch renamer.
aur/potool-renamed 0.19-1 (+0 0.00) (Orphaned) 
    Program to help editing po files, without poedit name clash
aur/tvmv-git 0.6.0.r1.g17b360e-1 (+0 0.00) 
    Command-line tool to bulk-rename TV episode files with minimal fuss.
aur/filebot-cli 5.1.6-1 (+0 0.00) 
    The ultimate TV and Movie Renamer
aur/swap 0.1.0-1 (+0 0.00) (Orphaned) 
    A very simple tool to swap two paths atomically using renameat2() on Linux.
aur/goi3autowname-git 0.2.r9.g351c6b3-1 (+0 0.00) 
    i3 workspace auto rename
aur/bios_renamer_for_asus-git r36.04c12c2-1 (+0 0.00) 
    Cross-platform Rust implementation of Asus' BIOS renamer utility.
aur/libsyncdir 1.0-1 (+0 0.00) (Orphaned) (Out-of-date: 2024-04-19) 
    Alternate implementation for open, link, rename, and unlink that executes a fsync on any modified directories
aur/flut-renamer 1.5.2-12 (+0 0.00) 
    A GUI application written in Flutter (using GTK on Linux), it helps users batch renaming their files in multiple ways, including inserting text, inserting file metadata and Exif data, replacing text, deleting text, rearranging, transliterating characters.
aur/sworkstyle-git 1.2.2.r2.g668ed8e-2 (+0 0.00) 
    Swayest Workstyle - This tool will rename workspaces to the icons configured. Mainly meant for Sway WM
aur/timestamp 1.3.0-1 (+0 0.00) 
    Configurable tool to rename files with dates from existing EXIF, XMP, or inode metadata
aur/bionic-batch-renamer-git r29.94fb8e3-1 (+0 0.00) 
    A powerful batch file renaming utility built with the Qt technology stack.
aur/ap-rename 1.601-1 (+0 0.00) 
    Perl-powered file rename script with many helpful built-ins
aur/movie-rename-bin 2.3.2-1 (+0 0.00) 
    A simple tool to rename movies, written in Rust.
aur/movie-renamer-bin 1.3.10_Alpha-1 (+0 0.00) 
    A Java app for easily renaming movie files
aur/ocaml-capitalization 0.17.0-3 (+0 0.00) 
    Defines case conventions and functions to rename identifiers according to them
aur/tvmv-bin 0.6.0-1 (+1 0.32) 
    Command-line tool to bulk-rename TV episode files with minimal fuss.
aur/music-file-organizer 1.0.1-1 (+1 0.00) (Orphaned) (Out-of-date: 2018-12-22) 
    Command-line audio file organizer that reads tags and renames files.
aur/brename-bin 2.14.0-2 (+1 0.10) 
    A practical cross-platform command-line tool for safely batch renaming files/directories via regular expression
aur/s3rename 0.2.0-1 (+1 0.00) 
    Tool to mass-rename S3 keys
aur/mved-og 3.0-1 (+1 0.00) 
    (mved) Carefully rename multiple files and directories
aur/sfrename 1.2.9-1 (+1 0.00) 
    Program for renaming files and directories
aur/i3-workspace-names 0.3.1-2 (+0 0.00) 
    Dynamically rename i3wm workspaces depending on windows
aur/sfbrename-gtk 1.0.0-1 (+1 0.10) 
    Simple bulk rename utility (GTK+ GUI and CLI tool)
aur/szyszka-git 3.0.0.r2.gfb6938c-1 (+1 0.00) 
    A simple but powerful batch file rename program
aur/sfbrename-cli 1.0.0-1 (+1 0.10) 
    Simple bulk rename utility (CLI tool)
aur/shopify-themekit-bin-noconflict 1.2.0-1 (+2 0.00) 
    A cross-platform tool for building Shopify Themes - renamed binary to theme-shopify
aur/python2-pyrenamer 0.6.1-4 (+2 0.00) 
    Application for mass renaming files.
aur/nomino-bin 1.6.1-1 (+2 0.05) 
    Batch rename utility for developers.(Prebuilt version)
aur/gmv 1.0-4 (+2 0.00) 
    GUI for 'mv': Adds 'Move or Rename' to 'open-with' context menu for most files.
aur/bulk-rename-plus 2.0.9-2 (+2 0.00) 
    Tiny yet Powerful Non-Interactive Bulk Renamer, written in C++
aur/szyszka 3.0.0-1 (+2 0.00) 
    A simple but powerful batch file rename program
aur/rhythmbox-plugin-fileorganizer-git 3.r16.ce123eb-1 (+1 0.00) (Out-of-date: 2023-12-23) 
    Music library organizer (move and rename files according to Rhythmbox database)
aur/pipe-rename-git 1.1.6.r1.gb734616-1 (+0 0.00) (Orphaned) 
    Rename your files using your favorite text editor
aur/arename 4.1-1 (+2 0.00) 
    automatic audio file renaming tool
aur/mmv-c-git 0.1.0-1 (+0 0.00) 
    Rename multiple files with editor like to mmv-go
aur/mmv-c 0.1-1 (+0 0.00) 
    Rename multiple files with editor like to mmv-go
aur/adbren-git r58.12bee5b-1 (+1 0.00) 
    Rename and organize anime using this AniDB API client written in perl
aur/nomino 1.6.1-1 (+3 0.00) 
    Batch rename utility for developers
aur/music-file-organizer-git 1.0.r5.gb5e828d-1 (+3 0.00) (Orphaned) 
    Audio file organizer that reads tags and renames files (development version)
aur/brename 2.14.0-1 (+3 0.00) (Orphaned) 
    A practical cross-platform command-line tool for safely batch renaming files/directories via regular expression
aur/swaywsr-git 1.4.0.r42.g193c4cb-2 (+3 0.00) 
    sway workspace renamer
aur/kim4 0.9.8-2 (+3 0.00) (Out-of-date: 2025-02-08) 
    Kde Image Menu to compress, resize, convert, rename and much more
aur/simplest-file-renamer-bin 1.0.0-8 (+0 0.00) 
    Rename your files directly or with your favorite text editor, making use of all your 1337 keyboard shortcuts.(Prebuilt version.Use system-wide electron)
aur/simplest-file-renamer-git 1.0.0.r73.g9eea2f0-1 (+0 0.00) 
    Rename your files directly or with your favorite text editor, making use of all your 1337 keyboard shortcuts.Use system-wide electron.
aur/fsed latest-1 (+0 0.00) 
    Rename files in batch using sed syntax
aur/net-names-crc16 1.0-1 (+0 0.00) 
    Udev rule and helper script to rename interfaces using a crc16 calculation based on the mac address
aur/neovim-renamer-git 3.0.3.r0.g3e9f083-1 (+0 0.00) (Orphaned) 
    VSCode-like renaming for Neovim
aur/farragone 0.2.5-1 (+4 0.00) 
    Batch file renamer for programmers
aur/id3ren master-1 (+4 0.00) (Out-of-date: 2025-03-03) 
    Batch rename mp3 files by reading ID3 tags
aur/mmv-go 0.1.6-1 (+0 0.00) 
    Rename multiple files with editor
aur/python-img-renamer v2.6.0-3 (+0 0.00) 
    Python script to rename images in numberic order.
aur/corerenamer-git 2.8.0.r0.2a292f8-1 (+0 0.00) (Orphaned) 
    A batch file renamer from the CoreApps family.
aur/workstyle-git 0.2.1.r29.g43b0b5b-1 (+4 0.00) 
    Dynamically renames sway/i3 workspaces to indicate which programs are running in each one
aur/neovim-renamer 5.1.0-1 (+0 0.00) (Orphaned) 
    VSCode-like renaming for Neovim
aur/file-rename 2.02-1 (+2 0.00) 
    Renames multiple files using regular expressions.
aur/pickle-beta 5.02-1 (+0 0.00) 
    The project was renamed from k8048. Is a programm for programm PICS. Beta Version.
aur/mvim-git v0.2.0-1 (+3 0.00) 
    Rename, move or delete files by editing their names with vim.
aur/desknamer-git r48.c130da0-3 (+0 0.00) (Orphaned) 
    automatically rename bspwm desktops based on applications inside
aur/krename-git 5.0.60.r863.00fc8b0-1 (+6 0.00) 
    A very powerful batch file renamer for KDE. (GIT Version)
aur/edir 2.30-1 (+7 0.20) 
    Program to rename, remove, and copy files and directories using your editor
aur/massren-git r187.93e8c66-1 (+0 0.00) 
    Easily rename multiple files using your text editor
aur/git-rename 1.0.0-3 (+1 0.00) 
    Easily rename a branch, locally and on the remote
aur/corerenamer 5.0.0-1 (+1 0.00) 
    A batch file renamer from the C Suite
aur/szyszka-bin 3.0.0-1 (+7 0.04) 
    A simple but powerful batch file rename program
aur/photoname 5.4-1 (+4 0.00) 
    Rename JPEG photo files based on shoot date
aur/caja-rename 25.1.1-1 (+2 0.00) 
    Batch renaming extension for Caja
aur/bulky 3.6-1 (+10 1.17) 
    Bulk File Renamer
aur/brn2-git r768.9c8b6f7-1 (+1 0.02) 
    fast bulk renamer with swapping
aur/perl-file-rename 2.01-1 (+2 0.00) 
    Renames multiple files using Perl regular expressions.
aur/sworkstyle 1.3.6-1 (+11 0.00) 
    Swayest Workstyle - This tool will rename workspaces to the icons configured. Mainly meant for Sway WM
aur/vimv-git r55.90bf552-1 (+11 0.00) 
    Batch-rename files using Vim
aur/brn-git r31.454e213-1 (+0 0.00) 
    Text editor based bulk rename utility.
aur/pickle 5.01-1 (+0 0.00) 
    The project was renamed from k8048. Is a programm for programm PICS.
aur/rnr-bin 0.5.0-1 (+2 0.10) 
    A CLI tool to rename files and directories that supports regex. Compiled binary
aur/filebot47 4.7.9-4 (+14 0.00) (Orphaned) 
    [Newer but paid version exist] The ultimate tool to rename TV/anime shows, download subtitles, and validate checksums.
aur/file-rename-utils 1.7.3-2 (+14 0.00) 
    Set of file renaming utils written in bash
aur/rng-rename 0.6.5-1 (+1 0.00) 
    A CLI tool to rename files to randomly generated strings.
aur/shorter 2.1-2 (+0 0.00) 
    rename series to unified format
aur/rnr 0.5.0-1 (+3 0.02) 
    A CLI tool to rename files and directories that supports regex.
aur/mp3rename 0.6-14 (+11 0.00) 
    Rename mp3 files based on id3tags
aur/rnm 4.0.9-2 (+4 0.00) 
    Bulk rename utility
aur/rn-bin 0.1.0-2 (+1 0.10) 
    Rename files and directories.
aur/rn 0.1.0-2 (+1 0.00) 
    Rename files and directories.
aur/massren 1.5.6-1 (+8 0.86) (Out-of-date: 2025-04-01) 
    Easily rename multiple files using your text editor
aur/regname 0.1.0-1 (+0 0.00) 
    mass renamer TUI written in Rust
aur/renamemytvseries-gtk-bin 2.1.7-1 (+0 0.00) 
    Rename your TV-Series using TheTVDB (GTK version)
aur/rename-photos-bin 0.1.0-1 (+0 0.00) 
    Bulk rename photos using EXIF data 🐶 (Prebuilt version)使用 EXIF 数据批量重命名照片.
aur/renamemytvseries-qt-bin 2.1.8-1 (+2 0.00) 
    Rename your TV-Series using TheTVDB (QT5 version)
aur/renamemytvseries-bin 2.0.10-1 (+1 0.00) 
    Rename your TV-Series using TheTVDB
aur/nautilus-renamer 4.0-1 (+39 0.00) (Orphaned) (Out-of-date: 2023-12-02) 
    Rename multiple files easily in Nautilus (Files).
aur/lltag 0.14.6-1 (+21 0.00) 
    Automatic command-line music (mp3/ogg/flac) file tagger and renamer
aur/rename-gru-git 0.8.2-1 (+0 0.00) 
    A CLI tool to batch rename files in the provided directory
aur/filebot 5.1.7-1 (+138 0.00) 
    The ultimate TV and Movie Renamer
aur/renrot 1.2.0-2 (+0 0.00) 
    Rename and losslessly rotate files according to their EXIF tags values
aur/tvnamer 3.0.4-1 (+8 0.00) (Orphaned) 
    Automatic TV episode file renamer
aur/rename.pl 2.0.0-2 (+0 0.00) 
    Rename files using perl expressions
world/krename 5.0.2-10 (493.7 KiB 2.2 MiB) 
    A very powerful batch file renamer
world/texlive-bibtexextra 2025.2-1.1 (6.0 MiB 40.6 MiB) [texlive] (Installed)
    TeX Live - BibTeX additional styles
world/renameutils 0.12.0-7.1 (83.2 KiB 292.8 KiB) (Installed)
    A set of programs designed to make renaming of files faster and less cumbersome
aur/rename 1.3-8 (+47 0.00) 
    Fast file renaming utility with support for string, regex and case
trinity:[nevj]:~$ 

Wow, that is more than I expected… but hidden in there is

aur/ap-rename 1.601-1 (+0 0.00) 
    Perl-powered file rename script with many helpful built-ins
and
aur/perl-file-rename 2.01-1 (+2 0.00) 
    Renames multiple files using Perl regular expressions.
and

aur/rename.pl 2.0.0-2 (+0 0.00) 
    Rename files using perl expressions
and
aur/rename 1.3-8 (+47 0.00) 
    Fast file renaming utility with support for string, regex and case

I think ap-rename may be what Daniel uses

trinity:[nevj]:~$ yay -S ap-rename
AUR Explicit (1): ap-rename-1.601-1
:: (1/1) Downloaded PKGBUILD: ap-rename
  1 ap-rename                        (Build Files Exist)
....

cant find the binary of the man page ???

trinity:[nevj]:~$ pacman -Ql ap-rename
ap-rename /usr/
ap-rename /usr/bin/
ap-rename /usr/bin/vendor_perl/
ap-rename /usr/bin/vendor_perl/prename
ap-rename /usr/share/
ap-rename /usr/share/man/
ap-rename /usr/share/man/man1/
ap-rename /usr/share/man/man1/prename.1.gz

OK so it put it in /usr/bin/vendor_perl/
which is not in the path

trinity:[nevj]:~$ ls /usr/bin/vendor_perl/
prename

and it is called prename
so man prename produces its man page.

RENAME(1)                   User Contributed Perl Documentation                  RENAME(1)

NAME
       rename - renames multiple files

VERSION
       version 1.601

SYNOPSIS
       rename [switches|transforms] [files]

       Switches:
....

I hope that is it???

OK, fix my PATH and should be ready to go

MX is different… the package is
rename - Perl extension for renaming multiple files
and it installs a binary called file-rename, with a pointer called ‘prename’

RENAME(1p)                     User Contributed Perl Documentation                    RENAME(1p)

NAME
       file-rename - renames multiple files

SYNOPSIS
       file-rename [ -h|-m|-V ] [ -v ] [ -0 ] [ -n ] [ -f ] [ -d ] [ -u [enc]]
       [ -e|-E perlexpr]*|perlexpr [ files ]

That seems different???
Now I am confused again.

So go back to Artix(Arch) and try another package

AUR Explicit (1): perl-file-rename-2.01-1
:: (1/1) Downloaded PKGBUILD: perl-file-rename

Now what did itinstall?

trinity:[nevj]:~$ pacman -Ql perl-file-rename
perl-file-rename /usr/
perl-file-rename /usr/bin/
perl-file-rename /usr/bin/perl-rename
perl-file-rename /usr/bin/vendor_perl/
.....
So I now have binaries

trinity:[nevj]:~$ ls -l /usr/bin/vendor_perl
total 40
-rwxr-xr-x 1 root root 21105 Apr 29 17:43 prename
-r-xr-xr-x 1 root root 4279 Apr 29 19:22 rename
-r-xr-xr-x 1 root root 4290 Apr 29 19:22 unsafe-rename

prename from previous attempt, and rename from current attempt

trinity:[nevj]:~$ ls -al /usr/bin/perl-rename
lrwxrwxrwx 1 root root 18 Apr 29 19:22 /usr/bin/perl-rename → vendor_perl/rename

so its binary is `perl-rename' or just 'reame'
and its man page agrees with MX

RENAME(1) User Contributed Perl Documentation RENAME(1)

NAME
rename - renames multiple files

SYNOPSIS
rename [ -h|-m|-V ] [ -v ] [ -0 ] [ -n ] [ -f ] [ -d ] [ -u [enc]]
[ -e|-E perlexpr]*|perlexpr [ files ]

DESCRIPTION
“rename” renames the filenames supplied according to the rule specified
as the first argument. The perlexpr argument is a Perl expression
which is expected to modify the $_ string in Perl for at least some of
the filenames specified. If a given filename is not modified by the

At last, I think I have the correct perl-based rename in Artix.

3 Likes

Now, just to confuse everyone, here is what Void has

[nevj@trinity ~]$ which rename
/usr/bin/rename
[nevj@trinity ~]$ rename -V
rename from util-linux 2.40.2

So Void has the same linux-utility version as Artix by default
Now what isavailable?

[nevj@trinity ~]$ xbps-query -Rs rename
[-] krename-5.0.2_3         Powerful batch renamer for KDE
[-] lltag-0.14.6_4          Automatic command-line mp3/ogg/flac file tagge...
[-] massren-1.5.7_2         Massive renamer from command line
[-] mmv-go-0.1.6_3          Rename and move multiple files at once with yo...
[-] perl-File-Rename-2.02_1 Perl module to rename filenames
[-] perl-rename-1.14_1      Renames multiple files using Perl regular expr...
[-] renameutils-0.12.0_3    Programs designed to make renaming of files fa...

Confusing again… is it perl-File-Rename-2.02_1 or perl-rename ?

[nevj@trinity ~]$ xbps-query -RS perl-rename

short_desc: Renames multiple files using Perl regular expressions

Maybe perl-rename… but perl-File-Rename looks awefully like ```
perl-file-rename that I just decided was the correct one in Artix ???

Package names can indeed be a source of confusion for those who use multiple distros.

3 Likes

Famous last words - this is why I prefer anything from the Debian “side”…

As previously posted - not easy to get “prename” on RHEL8 or (as I just verified) on RHEL9 (this is on a subscribed RHEL 9.4 instance)…

I have rename installed on a CentOS 7 “machine” I often use - but it’s the binary from elsewhere - not the perl (p)rename script :

╰─➤  file /usr/bin/rename
/usr/bin/rename: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0x50353dc8160bb36405f9583e8ba103c9bc1fcb9d, stripped

I won’t use this program - it’s too inflexible - I’d rather just use “mv” - and if I had to do multiple files - I’d probably break out a for loop, or a find command (or both)…

I’ll have to remember the syntax for doing this with perl and CPAN… Was early 2018 on RHEL6… I was lucky enough the RHEL6 instance had internet acces and I could use CPAN…

1 Like

It is one of the things that keeps coming back to haunt me.

3 Likes

Happy with pyRenamer, somewhat tricky to install, but very easy and powerful.

2 Likes

Hi Sandro,
If it works for you that is a good recomendation.
Thanks
Neville

3 Likes