renaming many files

Linux for blind general discussion blinux-list at redhat.com
Fri Jan 22 20:30:40 UTC 2021


Another poster has suggested rename.ul command. But it is not as safe as
the perl-based rename command, which would be used as follows:

   rename -v -n 's/^renewal talk //' "renewal talk *"

The "-v" option says verbose so describe what it's doing.

The "-n" option says don't do anything other than to report what would
be done otherwise (so remove the -n after you're sure the command is
going to do exactly what you want).

The expression in the single-quotes is any perl substitute command, so
can also be used to change lowercase to uppercase, and other tasks), and
note that the change-from field is anchored at the beginning of the
filename (via the caret sumbol), to avoid accidentally acting on
unintended files.

rename.ul acts like the old rename command, but if your system is less than
9 years old, you should check out this newer rename command.

On Fri, Jan 22, 2021 at 13:38:46PM -0600, Linux for blind general discussion wrote:
> I have many files in one directory which have the same two words in the beginning of the name.
> renewal talk 01 eating better
> renewal talk 02 exercise
> and so on.
> With the command line, is there a way of getting rid of ‘renewal talk’ for all files and keeping the other words in their names?
> 

-- 
Henry Yen                                       Aegis Information Systems, Inc.
Senior Systems Programmer                       Hicksville, New York




More information about the Blinux-list mailing list