Question: I recently converted all of my FLAC files to a lower sampling rate of 44.1 kHz and bit depth of 24 bits (because iPhone/iPod don't support anything above that) using XLD on my Mac OS 10.7 (Lion).

Although I told XLD to overwrote all previous files, XLD appended a `(1)` at the end of very file like from

```
some_song.m4a

```

to

```
some_song(1).m4a

```

So now I want to remove that `(1)` from all the FLAC files I converted.

I know I could have probably used some program or even an AppleScript to rename the files, but I wanted to learn using the old school way of command line.

I know that `find . -name *\(1\).m4a` will grab all the converted FLAC file.

Next I know I have to do something with `-exec` and `mv` to rename all the found files. But what I can't figure out is how to keep the original filename and only remove the `(1)`.

Maybe I need to do some group regex capturing to store the part of the filename that I don't want to modify? Or maybe it's not possible to do everything in one line and I should create a shell script (which I'm not that comfortable doing, but I'm willing to give it a try).

Any tips or suggestions are welcomed! Thanks!

Answer: 
On Debian and Ubuntu, I can use `rename 's/\(1\)//' *.m4a` to solve your problem.
In zsh, using [zmv](http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/zshcontrib.1.html):

```
autoload zmv      # you can put this line in your .zshrc
zmv '(*)\(1\)(*)' '$1$2'

```

In the second argument (the new name), `$1` and `$2` refer to the parenthesized groups `(PATTERN)` in the source pattern. Another way of writing this renaming is

```
zmv '(*)' '${1/\(1\)/}'

```