Reverting a field (SerialNumber) to null

Started by ericconn, July 31, 2024, 02:27:20 PM

Previous topic - Next topic

ericconn

I have some SerialNumber fields in JPG's that were converted into spaces and would like to revert them to null. When using exiftool -SerialNumber= (filepath) they don't truly revert to null, as when I write the files metadata to CSV and use -f the field is a blank cell in Excel, and not a "-" like it should be when using -f.

Thanks.

Phil Harvey

This is the format to write an empty tag:

exiftool -serialnumber^= FILE

- 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 ($).

StarGeek

Quote from: Phil Harvey on July 31, 2024, 03:17:23 PMexiftool -serialnumber^= FILE

On Windows CMD, you would have to use this, because the Caret ^ is a special character in CMD.
exiftool "-serialnumber^=" FILE
"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

ericconn

Thanks. That still yields a blank but not null field for me.

SourceFile   SerialNumber
D:/file.jpg   

StarGeek

Then your first command is what you want to use. But there is a caveat.  Some SerialNumber tags cannot be removed.

For example, in this file, the Canon:SerialNumber cannot be removed or cleared. It can only be set to a number. In the first command, I removed the EXIF:SerialNumber, but not the Canon:SerialNumber.  It then explicitly try to clear it. Then try to set it to a 0 length string, i.e. it exists but has an empty value. I try again with the hashtag shortcut for the -n (--printConv) option. The best I can do is set it to 0.
C:\>exiftool -G1 -a -s -serialnumber Y:\!temp\Test_CR2.Cr2
[Canon]         SerialNumber                    : 1470912081
[ExifIFD]       SerialNumber                    : 1470912081

C:\>exiftool -P -overwrite_original -SerialNumber= Y:\!temp\Test_CR2.Cr2
    1 image files updated

C:\>exiftool -G1 -a -s -serialnumber Y:\!temp\Test_CR2.Cr2
[Canon]         SerialNumber                    : 1470912081

C:\>exiftool -P -overwrite_original -Canon:SerialNumber= Y:\!temp\Test_CR2.Cr2
Warning: Can't delete Permanent tag Canon:SerialNumber
Nothing to do.

C:\>exiftool -P -overwrite_original "-Canon:SerialNumber^=" Y:\!temp\Test_CR2.Cr2
Warning: Not an integer for Canon:SerialNumber
Nothing to do.

C:\>exiftool -P -overwrite_original -Canon:SerialNumber#= Y:\!temp\Test_CR2.Cr2
Warning: Can't delete Permanent tag Canon:SerialNumber
Nothing to do.

C:\>exiftool -P -overwrite_original -Canon:SerialNumber=0 Y:\!temp\Test_CR2.Cr2
    1 image files updated

C:\>exiftool -G1 -a -s -serialnumber Y:\!temp\Test_CR2.Cr2
[Canon]         SerialNumber                    : 0000000000
"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