PDA

View Full Version : Shntool cmp for more than two files


Five
2005-03-09, 09:55 PM
Hey, here's a question for all you commandline gurus... In the FLAC conversion tutorial linked in my sig there's a section where I show how to comare just the audio in a FLAC set with a SHN set (or any format for that matter). I discovered that this functionality exists in SHNtool as well, but only accepts exactly two files. Can somebody help me out, do I need to use a .bat file or is there a generic command I can type to compare all SHNs with all the FLACs in a folder? It would be cool if I could generate a .log as well.

jazzbo
2005-03-09, 10:47 PM
I think you'll end up having to write a batch file, but another approach to this is to use shntool's md5 command with the -c switch. It will generate a composite md5 of all the files in a directory.

so shntool md5 -c *.shn in one directory should produce the same output as shntool md5 -c *.flac in another directory. To work perfectly, the files would have to be similarly named so the composite output was in the same order, but you'd have that problem with what you're trying to do as well.

I've not used DOS in ages, but there used to be a file compare command (fc), you could redirect the output of both shntool commands into temp files and then compare the results rather easily.

Obviously, if you want to find which file in the shn set is different from the flac set you'll need to do a more precise cmp of each individual file pair.

uhclem
2005-03-09, 11:06 PM
If the SHNs and FLACs are in the same folder and have the same names except for the extension, then you can type this at the command line:

for %F in (*.flac) do shntool cmp "%F" "%~nF.shn"

Five
2005-03-10, 04:02 AM
thanks uhclem, that did the trick!

so now I'm just wondering how to get a log of the results? I added > cmp.log to the end of your code and it just spit out the results of the last comparison (t8 in this case).

ps thanks also to Jazzbo, I'm sure your suggestion will come in handy with sets where I've corrected SBEs and want to verify the final results.

uhclem
2005-03-10, 01:31 PM
Try using >> cmp.log instead, i.e. double the >. See if that helps.

feralicious
2005-03-10, 04:16 PM
If the SHNs and FLACs are in the same folder and have the same names except for the extension, then you can type this at the command line:

for %F in (*.flac) do shntool cmp "%F" "%~nF.shn"Could you be any smarter? :crazy: