If I have a group of files with a .htm extention, how can I rename them all to .html?
mv *.htm *.html
does not work.
|
3
|
|||
|
|
|
|
Or, you could use pure bash... (except for mv, that is..)
and avoid the nasty basename stuff. ;) Bash has an extensive set of variable replacement options. The one used here, '%', removes the smallest matching pattern from the. Pattern in this case is a glob pattern, so See the variable substition section of the bash manpage for more neat tricks. There's a lot that can be done within bash directly. |
|||
|
|
|
|
There shouldn't be spaces, newlines or other whitespace in the filenames, but this version of freiheit's answer handles those. It also uses
|
||
|
|
|
|
Try it with an The problem with your original is that " |
||||||
|
|
|
|
||||||||||
|
|
|
If you use Zsh you can use 'zmv' |
||
|
|
|
|
The best tool is mmv.
Other examples of use (and of other tools) in "GNU/Linux Command-Line Tools Summary". |
||||
|
|
|
The util-linux-ng package (on Fedora) has a
|
||
|
|