I’m trying to come up with a command that would run mp3gain FOLDER/SUBFOLDER/*.mp3 in each subfolder, but I’m having trouble understanding why this command doesn’t work:
find . -type d -exec mp3gain \"{}\"/*.mp3 \;
When run, I get error Can't open "./FOLDER/SUBFOLDER"/*.mp3 for reading for each folder and subfolder.
If I run command manually with mp3gain "./FOLDER/SUBFOLDER"/*.mp3 it works. What’s going wrong?
When you run
mp3gain "./FOLDER/SUBFOLDER"/*.mp3from your shell, the*.mp3is getting expanded by the shell before being passed tomp3gain. Whenfindruns it, there is no shell involved, and the*.mp3is getting passed literally tomp3gain. The latter has no idea how to deal with wildcards (because normally it doesn’t have to).