If you happen to have zsh
shell available, then zmv
does almost exactly what you want, with very similar syntax:
zmv '*.download' '$1.html'
Just to point out why your attempt was wrong and dangerous: the wildcards *?
are expanded by your shell before the command is even called. So, mv
actually receives the entire list of files instead of *.download
, but *.html
has two ways of behaving (both quite bad):
If *.html
doesn't exist, your shell leaves the asterisk as part of the filename. You are attempting to move all the downloads to the same file named *.html
. mv
warns you that it's not a directory (otherwise you would just overwrite this file a number of times and end up with *.html
containing the last download). If *.html
does find one or more files, shell expands this into a list of files. Hopefully, none of them are directories, so this fails again for the same reason.
Note that you are extremely lucky, you could have lost data this way.
awk
?)... this will not only help to solve questions like this one, but zillions of other problems too... really! It's fun... especiallyawk
ist rewarding your invested time really fast... only a few hours with anawk
tutorial and you are settled to gain world domination... mwhuaaahahahahahahahaa! – Apr 03 '14 at 14:45awk
...?? – Hauke Laging Apr 03 '14 at 14:53awk
instead of installing a special tool for every differnent fart... – Apr 03 '14 at 15:00awk
"... – Hauke Laging Apr 03 '14 at 15:27