Sunday, September 7, 2008

Renaming Multiple Files with the Same Extension

sometime i have problem when i download or managing filename. because filename are same extension and disorganized.

so i use googling for searching script to help me managing file.

ok i write in here how to manage file in linux, of course command base, linux power full in command base.

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]

NOTE: Renaming multiple files at once is a common request.

No comments: