Renaming Multiple Files with the Same Extension

To give a different file name extension to a group of files that share the same file name extension, use chcase with the `−x' option for specifying a Perl expression; give the patterns to match the source and target files as a quoted argument.

For example, you can rename all file names ending in `.htm' to end in `.html' by giving `s/htm/html/' as the expression to use.
To rename all of the files in the current directory with a `.htm' extension to `.html', type:

$ chcase −x 's/htm/html/' '*.htm' RET

By default, chcase will not overwrite files; so if you want to rename `index.htm' to `index.html', and both files already exist in the current directory, the above example will do nothing. Use the `−o' option to specify that existing files may be overwritten.
To rename all of the files in the current directory with a `.htm' extension to `.html' and overwrite any existing files, type:

$ chcase −o −x 's/htm/html/' '*.htm' RET

Posted on: 16/12/2009








0 Comments
If you want to leave a comment please Login or Register
How to backup your data using rsync......
Understanding autoconf......
The Basics of fdisk......
Accessing Memory Using DMA......
The fd Directory......