ExifTool Forum

ExifTool => Newbies => Topic started by: nyxtyr on March 27, 2021, 12:28:06 AM

Title: -IF file has data in tag data processes it
Post by: nyxtyr on March 27, 2021, 12:28:06 AM
Working on a script to clear specific tags from files and want to loop it but I ran in to a problem where it keeps processing the files already processed. Below is what I have so far and it's working perfect with the exception it keeps processing files that don't have any data in the comment or title tags. I am trying to do something like "-if comment or title has data process it if not move to the next file"


:cleantime
C:\Users\encoder\Desktop\test\exiftool.exe -comment""= -title""= C:\Users\encoder\Desktop\test\* -r -ext mp4 -overwrite_original
timeout /t 60
goto cleantime
Title: Re: -IF file has data in tag data processes it
Post by: StarGeek on March 27, 2021, 02:19:59 AM
Try
exiftool.exe -r -ext mp4 -overwrite_original -if "$Comment or $Title" -comment= -title= C:\Users\encoder\Desktop\test\

If either the Comment or Title tag exists, then exiftool will clear both of them.  The asterisk at the end of the filepath is useless when you are using the -r (-recurse) option (https://exiftool.org/exiftool_pod.html#r-.--recurse), see Common Mistake #2 (https://exiftool.org/mistakes.html#M2).
Title: Re: -IF file has data in tag data processes it
Post by: nyxtyr on March 28, 2021, 12:21:01 AM
Works like a charm. Tested a few times and working perfect so far.