recursively rename files and remove a character

bash, linux, rename, xargs

Solution

` for file in $(find folder -name '*.mp3'); do mv -v "$file" $(echo "$file" | tr ? _); done`

The above has whitespace issues; this is better:

` find folder -name '*.mp3' -exec echo "'{}'" \; | while read file; do echo -n "mv -v $file " && echo $file | tr ? _; done | sh `

The idea is to find all the files, then echo them in quotes. Pipe the output into a `while` loop that constructs a `mv` command for each file, and then pipe that into a new shell.

Ugly, but if you don't like the answer, you shouldn't have asked the question. :-)

Problem

There are some file names which contain '?' As you know windows has problem with such characters. I want to recursively rename all files in the folders using `xarg`. For example ``` 09 - grand hall?_10.mp3 ``` should be ``` 09 - grand hall_10.mp3 ```

Original source