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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
whileloop that constructs amvcommand 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. 🙂