I have already written posts on splitting and converting from either album-length APE files or album-length FLAC files into track-length FLAC files.
(My post on converting APE files; my post on splitting APE files; my post on splitting FLAC files. You will want to go over these other articles if you have not done any of this before as there are some dependencies which you will not likely have installed.)
That was rather satisfying, but I then found that I would locate entire discographies where every album was a single APE or FLAC. I did not enjoy the prospect of running each command on each pair of files.
That’s why scripting languages exist. It’s a good thing I bought that BASH book.
Anyway, this script is designed to recursively locate APE, FLAC, and CUE files under a user-supplied root directory; then it runs shntool and cuetag on each APE/FLAC and CUE pair. (You can read my previous posts linked above for more details about how these two commands work.)
It even cleans up after itself. Since it deletes not only the temporary files it creates but also all the APE, FLAC, and CUE files it uses, you will want to pay close attention when the script tells you it is about to clean up all those files. If you tell it to proceed (by hitting ENTER) without checking its work all those files will be deleted. As such you should work from copies and you should check that it did what you wanted it to do before hitting ENTER when it asks about cleaning up all files.
Feel free to suggest any improvements. I hope you find that it works well and improves your lives.
One important thing to note is that it is not an intelligent script. It cannot determine for you whether a given APE or FLAC file is actually album length. It assumes that you are offering it a folder (with or without sub-folders) which contains only album-length APE or album-length FLAC files with an accompanying CUE file (one matching pair per containing folder).
Sometimes a cue file will be formatted incorrectly or have some other issue. Sometimes they can be fixed by opening them in a text editor. Probably they can always be fixed in a text editor, but it might be difficult to determine what’s wrong with the CUE file. If a CUE files has issues you will see errors on the command line (if you are staring at your monitor) and the album-length file will not be split/tagged. You’ll have to work on that pair separately, but since you are working from copies it won’t matter if they get deleted.
If you throw something unusual at it, it’s hard to imagine how it might behave. It’s likely not dangerous but you should always work from copies and preserve the originals until you are satisfied.
A couple of things have changed since I first wrote this script and article. First, the script no longer accepts ape files as input. You will want to convert them directly into flac files before splitting. This is very easy and at some point I’ll add notes on how to do that. Second, the script no longer lives here because it’s easier for me to maintain and share them over at GitHub.
Have a great time!