I'm building a simple batch file to compare the total count of files in a directory to the count of files matching -if "$track". if track is present then i have listened to the item (mp3)... and if the total count for track = total items then i have finished the album (directory).
Is there a simple way to count the items that match the -if "$track" criteria?
Thanks
Keith
Sorry if this is obvious, but I spent the appropriate amount of time searching the documentation and forum and came up empty handed.
I think the easiest way would be to pipe the exiftool output into grep (or find for windows) and take the "files read" line that appears at the end.
exiftool -if "$track" -PlaceholderTag FileOrDir | grep "files read"
Replace grep with find for windows. I just put "PlaceholderTag" in there as a fake tag to limit the output of exiftool.
Thanks I'll give it a try and report back.
Keith
The following subroutine worked, but yuch! I hate writing to a temporary file in a batch process. But since I only run this once a year or so, it's not that big a deal.
Thx
:subroutinecompare
REM Search each directory for any podcast having an entry in the track field
REM Compare count of files with track field to total files in directory
REM If equal then the album (directory) is finished (i'm done listening to the album)
setlocal EnableDelayed Expansion
c:\exiftool.exe -if "$track" -L -track !directory!>>c:\temp.m3u8
FOR /F "tokens=1 USEBACKQ" %%i IN (`find "files read" c:\temp.m3u8`) DO (SET done=%%i)
for %%x in (!directory!\*.mp3) do set /a count+=1
if !done! equ !count! echo !folder!>>c:\Finished.m3u8
endlocal
EXIT /b