Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
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 '12 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. – lamwaiman1988 Mar 2 '12 at 6:50
@lamwaiman1988 (and/or @Kevin), would you please update this with "the error message(s)"? For posterity. :) – pythonlarry Feb 7 '14 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 '14 at 14:49
up vote 4 down vote accepted

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).

share|improve this answer

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.

share|improve this answer
but I need rename many files. – lamwaiman1988 Mar 2 '12 at 4:17
True but not helpful here. – Gilles Mar 2 '12 at 22:41

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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