News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Using -tagsfromfile to copy to "almost identical" filename in a subdirectory

Started by robertklink, March 15, 2020, 05:17:37 PM

Previous topic - Next topic

robertklink

BACKGROUND: Windows 10 OS. Basic project is organizing ~ 15,000 images scanned from film. This post concerns dealing with "twin" image JPG scans from an era when I got both slides and negatives from each processed roll. Hence "twins" in the sense that for each "camera shot" I now have two files - one scanned from the negative and one from the slide. (The quality varies after the passage of time such that sometimes the neg is better or sometimes the slide.) They are named in the format YYYY-MM-RRR-##n and YYYY-MM-RRR-##s, Where RRR is a Roll ID, ## is the film image # from that roll and "n" designates it as a negative scan and "s" designates it as a slide scan. Hence the "almost identical" names, e.g., 1972-05-S12-01n.JPG and 1972-05-S12-01s.JPG

DIRECTORY STRUCTURE

Blah\Blah\....\1973 - root contains the SRCFILES, i.e., my pick of the best "s" or "n" image file, to each of which I have assigned a "ballpark" DateTimeOriginal.
Blah\Blah\....\1973\1973 All Negs & Slides - subdirectory contains all the "s" and "n" twin files, but lacking the desired DTO.
Ditto for 1974, 1975, 1976

WHAT I WANT: To "batch" copy the DateTimeOriginal from the source files in the YYYY root (which can be have either an "n" or an "s" suffix) to the corresponding "n" and "s"suffix files in the subdirectory.

WHAT I KNOW: In a similar but far simpler case -where I have identical filenames in an \[Originals] subdirectory (ACDSee app) -  the following CMDs work:

cd Blah\Blah\....\YYYY
exiftool -tagsfromfile .\%f.%e -DateTimeOriginal -overwrite_original .\[Originals]

I believe that some expert manipulation/extrapolation of the basic "%f%e" can get me to what I want, but I don't understand that well at all.

No need to do more than one YYYY directory at a time.




StarGeek

Just to clarify, the structure would be something like this
C:\Pictures\1973\1973-05-S12-01n.JPG
C:\Pictures\1973\1973 All Negs & Slides\1973-05-S12-01n.JPG
C:\Pictures\1973\1973 All Negs & Slides\1973-05-S12-01s.JPG
C:\Pictures\1974\1974-04-S02-01s.JPG
C:\Pictures\1974\1974 All Negs & Slides\1974-04-S02-01n.JPG
C:\Pictures\1974\1974 All Negs & Slides\1974-04-S02-01s.JPG


And you want to copy the DateTimeOriginal from C:\Pictures\1973\1973-05-S12-01n.JPG into the 1973-05-S12-01n.JPG and 1973-05-S12-01s.JPG files in the directory below it.

That's tricky, because you can't just do something like exiftool -r C:\Pictures\ <more options> because the top files would also be processed. You would have to specify just C:\Pictures\1973\1973 All Negs & Slide\ and C:\Pictures\1974\1974 All Negs & Slide\

I haven't tested it but maybe something like this
exiftool -r -if "$Directory=~/All Negs & Slides/i" -TagsFromFile %-:1d/%-.1fn.%e -DateTimeOriginal -TagsFromFile %-:1d/%-.1fs.%e -DateTimeOriginal C:\Pictures\

This will throw an error for each file because it has to look for both n and s root files.

The -if "$Directory=~/All Negs & Slides/i" will only process files that are in the sub directory.

The -TagsFromFile %-:1d/%-.1fn.%e and -TagsFromFile %-:1d/%-.1fs.%e work as follows.
%-:1d takes the directory one above the directory of the file processed.
%-.1f takes the base filename without the extension and removes the last letter.  Then it will check for a file with that file plus the s or r.
%e is the extension.

That's probably the best I can come up with. Maybe someone will come up with something better.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

robertklink

Yes that worked!

Here's a partial dump of CMD window output:
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-27n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-27n.JPG
Warning: Error rebuilding maker notes (may be corrupt) - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-28n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-28s.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-29n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-29n.JPG
Warning: Error rebuilding maker notes (may be corrupt) - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-31n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-31s.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-32n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-32n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-33n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-33n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-34n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-34n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-35n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-35n.JPG
Warning: Error rebuilding maker notes (may be corrupt) - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-36n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-36s.JPG
Warning: Error rebuilding maker notes (may be corrupt) - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-36n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-11-S24-36s.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-01n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-01n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-02n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-02n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-03n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-03n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-04n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-04n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-05n.JPG
Warning: Error opening file - C:/Users/rober/Pictures/Scansa_Scans/Twins/1973/1973-12-S25-05n.JPG
    3 directories scanned
  186 files failed condition
  356 image files updated
    5 image files unchanged

C:\Users\rober\Pictures\Scansa_Scans\Twins\1973>

The "5 image files unchanged" is okay because those 5 are "odd ducks" that don't exactly follow the naming convention. I can deal with those manually.
Not clear why I got so many "Warning: Error rebuilding maker notes (may be corrupt)" - I don't think those matter to me.
I did verify that I got matching "...n_original' and ",,,s_original" files everywhere I was expecting them.
(There's not always a matching twin because a few slides & neg strips got lost over the years.)

Thanks StarGeek!

StarGeek

You probably don't need to worry to much about the Error rebuilding maker notes warnings since you said these are scanned images.  MakerNotes in camera images can be important, especially for RAW images.   I can't think of how they would be important in scanned images or even what type of data they would hold.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).