A wildcard like that gets expanded into everything that matches it before the mv
command even runs. Making matters worse is that *.html
will also match your *.1.gz.html
files.
This means that (for example two files named abc.1.gz.html
and def.1.gz.html
) your command above is essentially running:
mv abc.1.gz.html def.1.gz.html abc.1.gz.html def.1.gz.html
This will try and move abc.1.gz.html
and def.1.gz.html
into a directory called def.1.gz.html
. Thankfully this fails as that file is not a directory.
You'll need to script something to look at each file one at a time
eg:
for file in *.1.gz.html; do
mv "$file" "`echo $file | sed 's/\.gz\.html$/.html/'`"
done
for file in *.html; do mv "$file" "${file/1.gz./}"; done
... See the Wooledge wiki on PE.