pren(1) General Commands Manual pren(1)
NAME
pren - rename files using Perl regular expressions (perl rename)
SYNOPSIS
pren [-h(elp)] -e perl_regex [-g(it)] [-n(o_rename)] [-q(uiet)]
[-v(erbose)] file...
DESCRIPTION
pren renames files using Perl regular expressions
OPTIONS
-h Print help and quit.
-e perl_regex
Specify the Perl regular expression to be used for file renames.
-g Rename files using "git mv" instead of perl's internal rename
function.
-n Do not actually rename any files. Instead, echo the rename
command that would be used.
-q Be quiet. Suppress the usual messages that list the file
renames that actually occur.
-v Be verbose. Generate messages for file renames that are skipped
because the name does not change.
EXAMPLES
Turn all instances of "apple" into "orange":
pren -e 's/apple/orange/' apple01.txt apple02.txt apple03.txt
Yields: orange01.txt orange02.txt orange03.txt
Improve the naming of digital camera images:
pren -e 's/^dsc/wedding/' dsc*.jpg
Yields: wedding*.jpg
Rearrange date format:
pren -e 's/(\d\d)(\d\d)(\d\d)/20${3}-${1}-${2}/' xmas_123104.txt
Yields: xmas-2004-12-31.txt
Poor man's lowercase utility:
pren -e 'y/[A-Z]/[a-z]/' DSC*.JPG
Yields: dsc*.jpg
Replace all underscores with spaces:
pren -e 's/_/ /g' song_name_*.mp3
Yields: "song name *.mp3"
Rename all files in a directory hierarchy:
find . -depth -print0 | xargs -0 pren -e 's/apple/orange/'
Note: The "-depth" switch is necessary to rename files before
renaming the directories that contain them.
BUGS
Symbolic links are not handled well by pren. For example, suppose you
have a file called "FOObar" and a symbolic link called "BARfoo"
pointing to it. If you rename both of them using pren, the symlink
will become broken, as it will still point to "FOObar".
SEE ALSO
git(1), lowercase(1), uppercase(1), perlre(1), prename(1), rename(1),
mmv(1)
COPYRIGHT
Copyright (C) 2005-2026 by Brian Lindholm. This program is free
software; you can use it, redistribute it, and/or modify it under the
terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
littleutils 2026 Jan 01 pren(1)
littleutils 1.4.0 - Generated Wed Feb 18 07:38:29 CST 2026
