I tried to rename all file with extension "XLS;1" to "XLS" but it just didn't work.

I tried the following in cygwin in windows xp and they don't work:

mv *.XLS;1 *.XLS

mv *.XLS\;1 *.XLS

mv "*.XLS;1" *.XLS
  • I figured it out, but in the future you should include the exact error message you get, it helps a great deal in fixing things, especially like this where the actual problem isn't what you think it is.
    – Kevin
    Mar 2, 2012 at 4:38
  • Oh...I thought the wildcard expansion will do the trick. Now the error message make sense, which I thought was just non-sense error message. Mar 2, 2012 at 6:50
  • @lamwaiman1988 (and/or @Kevin), would you please update this with "the error message(s)"? For posterity. :) Feb 7, 2014 at 14:40
  • @PythonLarry I don't have cygwin to get the exact messages, but they should be something along the lines of "mv: foo.XLS: not a directory" and "bash: 1: command not found"
    – Kevin
    Feb 7, 2014 at 14:49

3 Answers 3


The problem isn't the semicolon, your second example would take care of that. The problem is that Linux/Unix utilities (and, by extension, Cygwin) don't take that instruction to mean "move all files ending in .XLS;1 to .XLS," as I understand Windows does. You need to move each file individually:

for file in *.XLS\;1; do 
    mv "$file" "${file%;1}"

An explanation:

This takes all files ending in .XLS;1 and stores them one at a time into a variable named $file. For each file, we tell it to move that $file to a new name we create by chopping ;1 off the back of $file.

N.b. For those using zsh, there is a nice utility called zmv:

zmv '(*).XLS;1" "$1.XLS"

Depending on your setup you may need to run autoload zmv first (put it in your .zshrc too).


You can move by inode.

To find the inode

ls -i 

using the inode you just found

find . -inum <you just found> -exec mv {} <new name> \;

That should work on a unix system. No idea about cygwin.


Cygwin has util-linux package which contains rename:

rename ".XLS;1" ".XLS" *.XLS\;1

Or if there are no other semicolons in the file names, this is enough:

rename ";1" "" *.XLS\;1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.