Home » Questions » Computers [ Ask a new question ]

Apply a command to all files in a directory, one directory at a time

Apply a command to all files in a directory, one directory at a time

I want to apply replaygain information to all the MP3 files in my music collection. To do this, I'm using a tool called mp3gain (on Linux).

Asked by: Guest | Views: 372
Total answers/comments: 2
Guest [Entry]

"Looks like it's not globbing properly. How about something like this:

#!/bin/bash
OLDIFS=$IFS
IFS=$(echo -en ""\n\b"")
for dir in $(find . -type d)
do
mp3gain $dir/*
done
IFS=$OLDIFS

as a single command:

OLDIFS=$IFS;IFS=$(echo -en ""\n\b"");for dir in $(find . -type d);do mp3gain $dir/*;done;IFS=$OLDIFS"
Guest [Entry]

"You can use Rebol it works on Unix and Windows

How to apply a function to all files in a directory recursively

http://reboltutorial.com/blog/how-to-apply-a-function-to-all-files-in-a-directory-recursively/"