-overwrite_original option causes "File not found" error

Started by dwhutton, March 01, 2021, 05:42:06 PM

Previous topic - Next topic

dwhutton

I have been using the following command in Windows PowerShell to set the original date based on the filename (in a series of files whose names begin with 'signal').
exiftool '-DateTimeOriginal<${filename;$_=substr($_,0,24)}'  -r  -progress −overwrite_original . -ext jpeg -if '$filename =~ /^signal-/'

Now I want a batch file to do the same thing. I found that I needed to change the single quotes to double quotes thus:
exiftool "-DateTimeOriginal<${filename;$_=substr($_,0,24)}"  -r  -progress −overwrite_original . -ext jpeg -if "$filename =~ /^signal-/"

and it mostly works, except that the -overwrite_original option does not function and I get the following strange error message:
Error: File not found - GΩ╞overwrite_original

I have no idea what might be causing this. Any suggestions?

StarGeek

Are there unicode (non simple ascii) characters in the filename?  Windows CMD (batch files) do very poorly with non simple characters.  You can try some of the options listed in FAQ #18.

If you're on Windows 10, you could try this this StackOverflow answer.
* 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).

dwhutton

For the benefit of anyone else encountering a problem like this, it seemed to be caused by incorrect encoding of the text. I took steps which I believe ensured the text in the batch was in UTF-8, and the apparently identical code began to work fine.