红联Linux门户
Linux帮助

Rename file/directory in Linux/Unix

发布时间:2008-04-01 00:47:41来源:红联作者:Whretofi
Sometimes we need to rename certain file or directory. There are several way to do this job.

mv command. we can use this 'move' command to rename any file or directory. For example, if I want to rename 'ESTAR' directory to 'ESTAR_128', I can do this by typing

mv ESTAR ESTAR_128

rename command. This command seems only work to files. But it support wildcard character. So it is very powerful and flexible. Here is part of the manual of rename.

rename - Rename files

SYNOPSIS

rename from to file...

DESCRIPTION

rename will rename the specified files by replacing the first occur-

rence of from in their name by to.

For example, 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.

And

rename .htm .html *.htm

will fix the extension of your html files.

rename does not work in a same way between Ubuntu and Fedora. The rename manual is from Fedora.
文章评论

共有 0 条评论