July 12, 2023

Rename multiple files from the command line with rename.ul

To rename an occurence in multiple files run:

   $ rename.ul expression replacement files

where expression is the occurence of the expression to be replaced; replacement the part of the expression that will be replaced; and files the name of the files.

For example, if you want to replace IMG by _IMG in all the files starting by IMG, run

$ rename.ul IMG _IMG IMG*

Another example:

$ rename.ul foo foo00 foo?

and

    $ rename.ul foo foo0 foo??

will turn the files foo1, …, foo9, foo10, …, foo278 into foo001, …, foo009, foo010, …, foo2781.

Also:

     $ rename.ul .htm .html *.htm

will fix the extension of your html files2.

And:

     $ rename '_with_long_name' '' [filenames]*

will remove the substring in the filenames.

Run $ man rename.ul to display the manual and see the options.


  1. Example from the man page.↩︎

  2. Ibid.↩︎


command-line interface (cli) gnu linux trisquel text processing office applications personal computing wiki shell literacy

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88