ExifTool Forum

ExifTool => Newbies => Topic started by: KKP44 on June 25, 2018, 05:18:16 AM

Title: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 05:18:16 AM
I was wondering if I could somehow chain these operations in one command line:

-ext .jp2 -o %d%f.xmp -r DIR
-exiftool -tagsfromfile %d%f.xmp -all:all -r DIR
-exiftool -xmp-Exif:all= FILE

I also have a directory tree structure like this:

ROOT

--Folder 1
---Subfolder 1
---Subfolder 2

--Folder 2
---Subfolder 1
---Subfolder 2

--Folder 2
---Subfolder 1
---Subfolder 2

I need to replace a tag on all XMP files contained in Subfolder 2 of each main Folder. Is there a command that can do that?
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 07:12:31 AM
The straightforward answer is:

exiftool -ext .jp2 -o %d%f.xmp -r DIR -execute -tagsfromfile %d%f.xmp -all:all -r DIR -execute -xmp-Exif:all= FILE

Although I think your commands need some work.  The second command will also write the .xmp files, which probably isn't what you want.  Also, you could avoid copying the XMP-Exif in the first or second command to avoid having to delete it later.

- Phil
Title: Re: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 07:13:45 AM
Thank you for the answer! I edited the main post with a new question right as you answered it.

The tag i need to replaced as referenced in the main post is

<rdf:Description rdf:about=''
  xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'>
    <photoshop:Source>PLACEHOLDERTEXT</photoshop:Source>
</rdf:Description>
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 07:22:55 AM
Let's see if I understand:

You want to copy XMP-photoshop:Source from the .jp2 files in each folder to the .xmp files in subfolder2?  What is the name of subfolder2?  Hopefully they are all the same, otherwise it gets a bit more complicated.

- Phil
Title: Re: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 07:27:29 AM
I'll explain a bit:

The structure is named like this:

ROOT

-ID-222
--Originals
--Backup

-ID-223
--Originals
--Backup

in the Backup folder i have an x number of .jp2 files to which I've already written the xmp metadata but the tag data is wrong (the data is mismatched) so I want to replace the data with the correct one.


I've been doing this manually with ExifToolsGUI's Workspace method but I takes too long, because I have around 10k mismatched files and moving folder by folder will take way too long.
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 07:31:27 AM
OK, so you want to write XMP-photoshop:Source to the .jp2 files in the Backup folders.  From where?

- Phil
Title: Re: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 07:33:18 AM
I suppose I could write it down in a .txt file since the data is the same for every picture contained in that folder.

Right now every picture's xmp file contains this:

<rdf:Description rdf:about=''
  xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'>
    <photoshop:Source>ABCD</photoshop:Source>
</rdf:Description>

but it needs to contain

<rdf:Description rdf:about=''
  xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'>
    <photoshop:Source>DCBA</photoshop:Source>
</rdf:Description>


This applies to every file in every backup subfolder contained in the ROOT
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 07:35:48 AM
You could run this command for each folder:

exiftool -Photoshop:Source="Something" -ext jp2 FOLDER/Backup

Then you need to change "Something" and "FOLDER" for each folder.

- Phil
Title: Re: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 07:42:47 AM
FOLDER/Backup

Is this the full path to the directory?

example: C:\Desktop\ROOT\ID-222\Backup

And do I need to use " ?
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 07:45:00 AM
Quote from: KKP44 on June 25, 2018, 07:42:47 AM
FOLDER/Backup

Is this the full path to the directory?

Sure.  It could also be the relative path from the directory in which you ran the command.

QuoteAnd do I need to use " ?

Only if the directory name contains spaces.

- Phil
Title: Re: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 07:47:58 AM
1 directories scanned
   24 image files read
Warning: Tag 'Photoshop:Source' is not defined

This is the error message ExifTool gives me when I run the following comand

-exiftool -Photoshop:Source="TEST" -ext jp2 "C:\Users\Admin\Desktop\Test\ROOT\id-233\Backup"

EDIT:

ok I've figured it out

-exiftool -xmp-photoshop:source="TEST" -ext jp2 "C:\Users\Admin\Desktop\Test\ROOT\id-233\Backup"

Does the trick. It changes the value and leaves everything else intact.

Thanks so so so much for you help and great work! <3
Title: Re: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 07:57:06 AM
One more quick question:

Which part of this commmand exiftool -ext .jp2 -o %d%f.xmp -r DIR -execute -tagsfromfile %d%f.xmp -all:all -r DIR -execute -xmp-Exif:all= FILE creates the filename.jp2_ORIGINAL backup file?
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 07:58:30 AM
Quote from: KKP44 on June 25, 2018, 07:47:58 AM
ok I've figured it out

-exiftool -xmp-photoshop:source="TEST" -ext jp2 "C:\Users\Admin\Desktop\Test\ROOT\id-233\Backup"

Does the trick. It changes the value and leaves everything else intact.

Thanks so so so much for you help and great work! <3

Great.  Yes, I forgot the "XMP-" in my command.  Glad you figured it out.

- Phil
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 07:59:37 AM
Quote from: KKP44 on June 25, 2018, 07:57:06 AM
Which part of this commmand exiftool -ext .jp2 -o %d%f.xmp -r DIR -execute -tagsfromfile %d%f.xmp -all:all -r DIR -execute -xmp-Exif:all= FILE creates the filename.jpg_ORIGINAL backup file?

Any command that edits an existing file will create the "_original" backup.  The second and third parts of the command may do this.
Title: Re: Multiple commands in one line
Post by: KKP44 on June 25, 2018, 08:02:42 AM
Quote from: Phil Harvey on June 25, 2018, 07:59:37 AM
Quote from: KKP44 on June 25, 2018, 07:57:06 AM
Which part of this commmand exiftool -ext .jp2 -o %d%f.xmp -r DIR -execute -tagsfromfile %d%f.xmp -all:all -r DIR -execute -xmp-Exif:all= FILE creates the filename.jpg_ORIGINAL backup file?

Any command that edits an existing file will create the "_original" backup.  The second and third parts of the command may do this.

Is there a way to bypass the creation of backups?

EDIT: Found the answer in another topic.  It's -overwrite_original if anyone stumbles upon this thread.

Thanks again for all your help!
Title: Re: Multiple commands in one line
Post by: Phil Harvey on June 25, 2018, 08:03:03 AM
Add -overwrite_original to the command.