Code to remove all XMP Hierarchical Entries in multiple folders

Started by SeanBH, April 16, 2021, 12:11:10 AM

Previous topic - Next topic

SeanBH

Hello All- first post! Please bear with me as I try to ask this...all I am trying to achieve is simple keyword management. I have been using Adobe Bridge for years, then to ACDSee Photo Studio Ultimate, and now trying to figure out just how I can remove the most metadata out of my 60k+ files as I can. I screwed up with Bridge and stupidly used a * addendum to a keyword when Bridge gave me problems, and now after cleaning up the keyword tags as much as I can in File Explorer, I see those * keywords still exist in the SubjectHierarchy fields of XMP. In addition, the keyword list I originally setup was hierarchical, and I'm getting the root keywords in that field even though in Bridge I selectively sanctioned only a few to do that. I'm going to go back to a flat keyword design for simplicity.

I just want to clean out as much as I can, and have ExiftoolGUI 5.16 that I'm using. I've done a few subfolders using Modify>Remove Metadata options, but I don't know exactly what each one of those option are and what they affect. I want preserve my OriginalDate and Date Taken. I have all of the 60k+ files in about 282 folders. Eventually I want to trim that down but only after I "perfect" the keywords. I have scoured the web for examples, but I only bits and pieces, and since I'm not a code writer, it's all greek to me. I would appreciate some help!

I have my Pictures folder backed up on 4 drives, so I'm not worried about screwing things up, but want to be sure.

So far, I've been able to gleem some basics...like using in the ExiftoolDirect field: exiftool -HierarchicalSubject= -r -overwrite_original in my highest subfolder, but not quite sure about how to direct that, or even if there are better options for preserving date and keyword information yet removing everything else.

Can anyone please help me? I've been googling how to fix this for 5 days and I'm not getting anywhere [yet]. Thanks!

FYI...I tried this command on a lower file and got the following error message...not quite sure exactly what it was telling me, but it did rid the file I targeted of the HierachicalSubject field:

======== F:/Pictures/Work/Sean/Kaman/OKNK2702.JPG
    3 directories scanned
   19 image files updated
    4 image files unchanged
    2 files weren't updated due to errors
Error: File not found - exiftool
Error: End of processing at large atom (LargeFileSupport not enabled) - F:/Pictures/Work/Sean/Kaman/19920000 Doskocil Machines-983H, RC11, RC14SP.mp4
<-END-

StarGeek

You would not put exiftool in the direct box as I believe the GUI will add that for you.  And if I recall, there should be menu options (I think) to keep the file system timestamp and use the -overwrite_original option.

Or you could just use that command on the command line, possibly adding the -P (-preserve) option to keep the file system timestamps the same because command will remove all the HierarchicalSubject tags in all the subdirectories of the path you give.  The only thing missing is the path, for which you can use a dot . if you CDed to the directory you want or you can drag/drop the directory onto the command line.  Make sure you hit space though before drag/drop.



Finally, you could rename exiftool to
exiftool(-HierarchicalSubject= -r -overwrite_original -P).exe
and drag/drop the directory right onto the exiftool icon
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SeanBH

Wow StarGeek, lots to chew on here and THANKS!- I suspected you'd be first at chiming in and I'm glad you did. First, from your animated examples I see you must've put modified Exiftool.exe in your Windows/System32 folder- I had instruction to put it in the c:/Windows directory. Perhaps better to put in System32?? Anything I need to do other than moving the file to do this? I was perplexed at the beginning on exactly how to drag and drop and now I see why. But the "hit space" comment has got me miffed- HIT space BEFORE the drag & drop?

Makes sense that the GUI would know the exiftool beginning is redundant. The -p option looks promising. I'm probably more into using the GUI to issue the command, so the full command would be -HierarchicalSubject= -r -p -overwrite_original . ? Being a complete newbie to this command line stuff, I've found it hard to find concrete examples to exactly what the syntax should be when it comes to using a command-I've done some basic DOS programming YEARS ago, but I must've killed those brain cells.  ;D

And sorry to pile on here, but is there other metadata I should be deleting in addition? My initial query was to to delete as much metadata as I can without losing the basic information like dates and keywords. Maybe someone can chime in with the "Remove Metadata" option in the GUI- maybe I'm overlooking something.

StarGeek

Quote from: SeanBH on April 16, 2021, 01:20:23 AM
First, from your animated examples I see you must've put modified Exiftool.exe in your Windows/System32 folder- I had instruction to put it in the c:/Windows directory.

Actually, I don't have it there.  That was just the current directory of the new CMD I opened to make that. This is more info than needed, but the path to my exiftool is C:\Programs\UnixUtils\Exiftool.  The Programs directory is a directory of simple programs that don't need installing (basically portable programs) so I could just copy the whole directory when changing computers, reformatting drives, etc.

QuotePerhaps better to put in System32??

Any directory in PATH will work.  Technically the best would be to place it in a new directory and add that to the PATH but that can be more complex than most new users can deal with.

QuoteAnything I need to do other than moving the file to do this?

Just the rename to remove the parenthesis text unless you're doing a drag/drop type command.

QuoteI was perplexed at the beginning on exactly how to drag and drop and now I see why. But the "hit space" comment has got me miffed- HIT space BEFORE the drag & drop?

Hit space before dragging/dropping onto the CMD.  You need to make sure the command is separated from the directory. The second example, dragging/dropping onto the icon doesn't need a space.

QuoteThe -p option looks promising.

Capital P, the lowercase p is the -p (-printFormat) option.  Big difference.

QuoteI'm probably more into using the GUI to issue the command, so the full command would be -HierarchicalSubject= -r -p -overwrite_original . ?

In the GUI, no dot.  You would select the files there.  I don't know if you can select directories or not.  The old GUI never worked for me.

QuoteAnd sorry to pile on here, but is there other metadata I should be deleting in addition? My initial query was to to delete as much metadata as I can without losing the basic information like dates and keywords. Maybe someone can chime in with the "Remove Metadata" option in the GUI- maybe I'm overlooking something.

I would guess the "Remove Metadata" option would remove all metadata.  Personally, I wouldn't use that for a personal collection, only on copies you might want to share with someone without sharing personal data.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SeanBH

I really do appreciate the time you take to help out here- thank you! I'll try this out after I take a full image of my drive- just in case!

SeanBH

I just used the -HierarchicalSubject= -P -overwrite_original and it worked fine in a single directory using the GUI! I now just have to figure out how I can globally do this with all my files without having to go to 282 folders to accomplish this.

StarGeek: Just another question: I sometimes have duplicate keywords in Exif:XPKeywords as well as IPTC:Keywords. I caught your VERY impressive "Windows Metadata" post from 2015, and I'm wondering if Windows uses XMP:Subject, IPTC:Keywords, and EXIF:XPKeywords, which single one of these should I be using and keeping as the primary field for keywords? And if, for say, I wanted to keep EXIF:XPKeywords as the depository for my keywords, what command would I use to move IPTC:Keywords over to it?

StarGeek

I would recommend against using EXIF:XPKeywords.  It is pretty much a Windows only tag and hardly any programs will read it.  It's also a semicolon separated string, not a List Type tag like the other two.  Using either IPTC:Keywords and/or XMP:Subject are good choices.  It depends upon what programs you use with your images.  Most modern programs, such as Digital Asset Management programs like Lightroom and DigiKam, will use either of them, but if you need to use older programs, like in my case, Irfanview, you may want to use the IPTC:Keywords.

Let me get back to you on the command.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SeanBH

Quote from: StarGeek on April 16, 2021, 04:44:11 PM
I would recommend against using EXIF:XPKeywords.  It is pretty much a Windows only tag and hardly any programs will read it.  It's also a semicolon separated string, not a List Type tag like the other two.  Using either IPTC:Keywords and/or XMP:Subject are good choices.  It depends upon what programs you use with your images.  Most modern programs, such as Digital Asset Management programs like Lightroom and DigiKam, will use either of them, but if you need to use older programs, like in my case, Irfanview, you may want to use the IPTC:Keywords.

Let me get back to you on the command.

You are a godsend!

So far, I've used Bridge, which I used for a few years until I wanted to redo all my tags, but gave me fits trying to rename keywords. I also hated how it embeds itself everywhere on my drive and the fact that it also requires the Creative Cloud stuff, which propagates itself everywhere as well. Then I purchased ACDSee, which I found out doesn't automatically write back to the file but uses it's own database (it will write back, but you've got to remember to do that when you're done). Lightroom looks to be a good option, but screw anything that is subscription based. Most of the time I am setting keywords in good 'ol File Explorer, but I did run across a program PIE (Picture Information Extractor) that looks promising if I can get them to respond about being able to bring up ALL my files without having to select each folder to do so. If I get the answer I want, then I'll purchase ($29) the program so I can write keywords to the files. I don't need much...keywording is about all I need, so if you've got a better suggestion, I'd love to hear it! Thanks again!

StarGeek

For just keywords, try hvdwolf's jExifToolGUI.  And then there's this program from a few months ago which focuses just on keywords.  It was too limited for my use so I never tried it.

DarkTable and DigiKam, both free, might be worth looking into.  They're pretty good DAM programs.

Then on the expensive side, there's IMatch.  Pricey but it has a lot of power. I've been using it since ver 3. If I have to do any sort of metadata search, it's what I use.  It uses exiftool behind the scenes as well.

I thought I had posted a config file for consolidating Subject and Keywords, but it looks like I never did.  I'll pull that out of my .exiftool_config file tomorrow and add in the XPKeywords tag.  What it will do is grab all the keywords from all fields, remove any duplicates, and return the results.  That way you can copy them to any tag you wish or directly back onto IPTC:Keywords/XMP:Subject.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SeanBH

Quote from: StarGeek on April 16, 2021, 10:00:16 PM
For just keywords, try hvdwolf's jExifToolGUI.  And then there's this program from a few months ago which focuses just on keywords.  It was too limited for my use so I never tried it.

DarkTable and DigiKam, both free, might be worth looking into.  They're pretty good DAM programs.

Then on the expensive side, there's IMatch.  Pricey but it has a lot of power. I've been using it since ver 3. If I have to do any sort of metadata search, it's what I use.  It uses exiftool behind the scenes as well.

I thought I had posted a config file for consolidating Subject and Keywords, but it looks like I never did.  I'll pull that out of my .exiftool_config file tomorrow and add in the XPKeywords tag.  What it will do is grab all the keywords from all fields, remove any duplicates, and return the results.  That way you can copy them to any tag you wish or directly back onto IPTC:Keywords/XMP:Subject.

Thanks again, StarGeek...I've taken a look at these, and the one that was the most promising after reading your post was JpegKeywords by eed...as I was reading his post, I was getting real excited because he mentions ALL that I am looking for- EXCEPT...the 10 images at a time- that's a deal breaker for me, and the interface is probably a bit too simple. My problem, as I mentioned with PIE, is being able to bring up ALL images at one time in a list view so I can look through the keywords. And judging by the file size of iMatch, I would assume it uses a database as well? And jExifToolGUI...I thought Java was a no-no or did Oracle finally fix its vulnerabilities? Otherwise I like the idea someone has carried the GUI torch. I'll continue to look at them and try them out.

I've read about this config file but not quite sure how to implement...I'm curious as to what it will show me. Again, thanks for ALL your help here!

StarGeek

Quote from: SeanBH on April 17, 2021, 11:57:09 AMAnd judging by the file size of iMatch, I would assume it uses a database as well?

It does use a database so searching metadata doesn't require reading through thousands of files, but it can be set to automatically write out the data to the files or sidecars.

QuoteAnd jExifToolGUI...I thought Java was a no-no or did Oracle finally fix its vulnerabilities?

I don't know anything about this.  I've used several java programs without problems.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

StarGeek

Quote from: SeanBH on April 17, 2021, 11:57:09 AM
I've read about this config file but not quite sure how to implement...I'm curious as to what it will show me. Again, thanks for ALL your help here!

Just realized that there probably isn't a way to use the config file with the GUI.  But the config file can be found here.  It would have to be used on the command line.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

SeanBH

Ok...I can live with that. I appreciate you looking into it!

Phil Harvey

Couldn't you use a config file with ExifToolGUI by naming it ".ExifTool_config" and placing it in the "exiftool.exe" directory?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

SeanBH

Quote from: Phil Harvey on April 18, 2021, 07:21:04 AM
Couldn't you use a config file with ExifToolGUI by naming it ".ExifTool_config" and placing it in the "exiftool.exe" directory?

- Phil

Hi Phil! I must say a hearty "Thank you!" for creating ExifTool! I am simply amazed at not only the work in creating it, but this fantastic support and maintenance provided.

That thought crossed my mind, but I'm just a newbie trying to clean up all my keywords. The closest I ever got to programming as typing in a Blackjack basic program onto a cassette deck drive that fed my RS TRS-80 4K Level II computer.  ;D Actually, that got me a little into tweaking VBA code in Excel.

Just to clarify, when you say naming it".exiftool.config, are you talking the config file or the GUI.exe? Does the Exiftool direct option just process then after that?