rename (linux only, not ubuntu)

Rename files.

Syntax
      rename from to file...

rename will rename the specified files by replacing the first occurrence of from in their name by to.

Examples

Given the files foo1, ..., foo9, foo10, ..., foo278, the commands

$ rename foo foo0 foo?
$ rename foo foo0 foo??

will turn them into foo001, ..., foo009, foo010, ..., foo278.

Fix the extension of your .htm files so they become .html :

$ rename .htm .html *.htm

Rename all files (*) to be lowercase:

$ rename 'y/A-Z/a-z/' *

An alternative is to use a for loop, for example to change a bunch of .txt files to have the extension .html

$ for i in *.txt; do mv "$i" "`basename $i .txt`.html"; done

“Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it is the only thing that ever has” ~ Margaret Mead

Related
:

mv - Move or rename files or directories.
Equivalent Windows command: REN - Rename files.


© Copyright SS64.com 1999-2013
Some rights reserved