mac does one file at a time, so you have to work around it.
Assuming the files you want to encode/decode are in specific folders, or sub-folders, and not arbitrary paths, you can do it with a combination of find, sed and xargs.
For example, to encode all WAV files in a specific folder and all its subfolders, with the output files simply having the APE extension, using the fast
-c1000 preset, you would type:
find ~/path/to/folder -name *.wav | sed 's/....$//g' \
| xargs -I MACFILE mac "MACFILE.wav" "MACFILE.ape" -c1000
find finds all files with the wav extension in and under the given path, and outputs them.
- You can use
`pwd` (with the backticks) as shorthand for the current folder.
- Add the argument
-maxdepth 0 to stick to the current folder only and not go into subfolders.
- The sed expression deletes (i.e. replaces with "blank") the last four characters of each filename returned by find, which is the extension
- xargs feeds each filename piped in to the
-I MACFILE tells xargs to replace each occurrence of MACFILE with the input (filename); this way we get files with proper extensions and not
To decode within the current folder only, and output to a custom folder, for example:
find `pwd` -name *.ape -maxdepth 0 | sed 's/....$//g' \
| xargs -I MACFILE mac "MACFILE.ape" "/home/ryan/decodes/MACFILE.wav" -d
Note: find is one of those utilities that are almost limitless (see
man find). With the right
-printf options (and maybe more), find may alone be sufficient without needing the sed and xargs, and I'm sure someone will point that out :) . But I find this easier to explain and understand.