Instead of renaming, ExifTool outputs metadata values

Started by Jom, July 28, 2022, 07:07:02 PM

Previous topic - Next topic

Jom

I am using PowerShell 7 in Windows 10, but instead of renaming, ExifTool outputs metadata values.

PS D:\_temp> exiftool -progress: -progress -charset filename='' -charset exif=UTF8 -d '%Y%m%d_%H%M%S' '`
>> -FileName<`
>> ${exif:datetimeoriginal}_`
>> ${exif:offsettimeoriginal;s/\+/f/;s/-/b/;s/://}_`
>> ${exif:model;s/ //g}_`
>> ${exif:serialnumber}_`
>> ${xmp-crs:rawfilename;s/\..*$//}.%ue`
>> ' -ext cr2 .
======== ./IMG_1744.CR2 [1/1]
ExifTool Version Number         : 12.44
File Name                       : IMG_1744.CR2
Directory                       : .
File Size                       : 19 MB

Please, help.
What's wrong?

StarGeek

Try putting it all on one line?  I used TestName instead of actually renaming but the results were correct.
* 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).

Jom

All on one line is correct.

PowerShell 7.2.5
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS D:\_temp> chcp 65001
Active code page: 65001
PS D:\_temp> exiftool -progress: -progress -charset filename='' -charset exif=UTF8 -d '%Y%m%d_%H%M%S' '-FileName<${exif:DateTimeOriginal}_${exif:OffsetTimeOriginal;s/\+/f/;s/-/b/;s/://}_${exif:Model;s/ //g}_${exif:SerialNumber}_${XMP-crs:RawFileName;s/\..*$//}.%ue' -ext cr2 .
======== ./IMG_1744.CR2 [1/1]
'./IMG_1744.CR2' --> './20220726_193209_f0300_CanonEOS600D_163066096287_IMG_1744.CR2'
    1 directories scanned
    1 image files updated
PS D:\_temp>

This is strange...

Jom

Another behavior option:

PS D:\_temp> exiftool -progress: -progress -charset filename='' -charset exif=UTF8 `
>> -d '%Y%m%d_%H%M%S' '-FileName<`
>> ${exif:DateTimeOriginal}_`
>> ${exif:OffsetTimeOriginal;s/\+/f/;s/-/b/;s/://}_`
>> ${exif:Model;s/ //g}_`
>> ${exif:SerialNumber}_`
>> ${XMP-crs:RawFileName;s/\..*$//}.%ue`
>> ' -ext cr2 .
======== ./IMG_1744.CR2 [1/1]
Warning: No writable tags set from ./IMG_1744.CR2
Nothing changed in ./IMG_1744.CR2
Warning: Invalid tag name '`'. Use '=' not '<' to assign a tag value - ./IMG_1744.CR2
    1 directories scanned
    0 image files updated
    1 image files unchanged
PS D:\_temp>

Jom

Another behavior option:

PS D:\_temp> exiftool -progress: -progress -charset filename='' -charset exif=UTF8 `
>> -d '%Y%m%d_%H%M%S' '-FileName<${exif:DateTimeOriginal}_`
>> ${exif:OffsetTimeOriginal;s/\+/f/;s/-/b/;s/://}_`
>> ${exif:Model;s/ //g}_`
>> ${exif:SerialNumber}_`
>> ${XMP-crs:RawFileName;s/\..*$//}.%ue`
>> ' -ext cr2 .
======== ./IMG_1744.CR2 [1/1]
'./IMG_1744.CR2' --> './20220726_193209_`
f0300_`
CanonEOS600D_`
163066096287_`
IMG_1744.CR2`
'
Warning: New file name not allowed in Windows (contains reserved characters) - ./IMG_1744.CR2
    1 directories scanned
    0 image files updated
    1 files weren't updated due to errors
PS D:\_temp>

StarGeek

Warning: Invalid tag name '`'.

That indicates that PS is not processing the backtick correctly and is passing it do exiftool.

Personally, I recommend using CMD over PS when it comes to exiftool.  It has too many idiosyncrasies compared to other shells.  Too many problems can be traced to using it over CMD and it's corruption of binary data in pipes/redirection makes it a non-starter for me.
* 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).

Jom

Yes, I have already realized that it's a matter of wrapping a line, everything is fine with individual commands. I tried different Perl syntax for wrapping, but nothing worked. It looks like it's PS.

When you used PS, did you use
chcp 65001for extracting image from RAW?

StarGeek

* 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).