Also, to understand what your first try says, and why it can't work:
Pretend you're in a directory containing [tt]cat.JPG[/tt], [tt]dog.JPG[/tt], and [tt]pig.JPG[/tt].
When you say:
it gets expanded to:
Code:
mv cat.JPG dog.JPG pig.JPG *.jpg
or
Code:
mv cat.JPG dog.JPG pig.JPG
Your shell performed wildcard expansion (also known as globbing).
It looked for all files whose name was something followed by [tt].JPG[/tt] and came up with three matches.
Then, it looked for all files whose name was something followed by [tt].jpg[/tt]. It, of course, found no such name, so it either assumed you meant a file named [tt]*.jpg[/tt] or allowed it to expand to nothing, depending on how it's set up to handle null globs.
So... [tt]mv[/tt] gets 3 or 4 arguments. If you look at the man page for [tt]mv[/tt], it'll tell you that whenever you give more than 2 arguments, the last one must be a directory, and all previous arguments will be moved into it. If the last argument is not an existing directory, it's an error.
Of course, that makes perfect sense. It's pretty much always going to be a mistake to try to rename a group of files to the same thing; you'd just end up deleting all the files except for one lucky one, which would get renamed to the last argument.
Thus, since neither [tt]pig.JPG[/tt] nor [tt]*.jpg[/tt] is an existing directory, the command you generate is an error.
Now, I don't know how DOS handles that kind of construct that you claim works. If it really does, here's an attempted explanation of why it does (and why it shouldn't).
First of all, the [tt]*.jpg[/tt] would somehow have to expand to a list of nonexistant filenames, probably based on the results of the previous glob on the same line. That'd be horrible hack #1. What happens if you wanted that second glob to expand to
actual filenames? What controls how that list gets generated from the original? What happens if you have 3 globs per line? Horrible, horrible...
Second of all, the program doing the move operation would basically have to look at your arguments, check to see that they're an even number, and make the assumtion that you want to divide that list in half, then move each file in the first half to each file in the second half. So what happens when you try to move a bunch of stuff to a single directory, and you happen to have an even number of arguments? Do you move everything into that directory, or do you clobber the second half of the list with the first half? Horrible, horrible.
Ok, admittedly, I do know there's a separate DOS [tt]move[/tt] and [tt]rename[/tt] command, so that second point might not be as big a hack as I make it out to be. However, the first one is still valid, and the second should still give you some insight on why your original command can't work (in UNIX, anyway).
As a final example/warning, pretend you've only got [tt]cat.JPG[/tt] and [tt]dog.JPG[/tt], and pretend your shell is set up to expand [tt]*.jpg[/tt] into nothing when there are no matching files.
expands to:
and you now nove no pictures of a dog, and one picture of a cat named [tt]dog.jpg[/tt].
(Oh, and you may be amused to know that when I originally typed this, I meant to put [ignore][tt]cat.JPG[/tt][/ignore] to produce [tt]cat.JPG[/tt], but I accidentally typed [ignore]
![[cat] [cat] [cat]](/data/assets/smilies/cat.gif)
.JPG[/tt][/ignore], which happens to expand to
![[cat] [cat] [cat]](/data/assets/smilies/cat.gif)
.JPG[/tt], so you would have gotten a funny-looking filename had I not thought to preview before submitting).