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: 
Don't try to parse `find` output except as a last resort. It is important to realize that on Unix file systems, file names are not strings (a common misconception) but rather *binary blobs* which can contain any character except `/` and the null character. Parsing file names safely and correctly is enough of a pain that 99% of the time you'll just want to avoid doing it altogether (just look at how hairy the `sed` expression in [@yarek's answer](https://unix.stackexchange.com/a/38455/9537) is and even that doesn't cover all cases). Thankfully, in this case there is a much simpler approach:

```
find . -name '*(1).m4a' -execdir sh -c \
'for arg; do mv "$arg" "${arg%(1).m4a}".m4a; done' _ {} \+

```
On Debian and Ubuntu, I can use `rename 's/\(1\)//' *.m4a` to solve your problem.