Warning: garbage at end of string in strptime

Started by marto2013, May 24, 2020, 12:57:54 AM

Previous topic - Next topic

marto2013

Hi :),
How can I set filemodifydate from filename that has different symbols with different length? I will give some filename examples:
"2018-11-06___Изоставеният град.docx"
"2019-01-25___Изпитът.docx"

What I tried:

PS D:\Documents\Personal\Dreams> exiftool -d "%Y-%m-%d" "-filemodifydate<filename" "2017-07-22___Сънищата-с-Кучетата.docx"
Warning: garbage at end of string in strptime: ___Сънищата-с-Кучетата.docx in File:FileModifyDate (PrintConvInv) - 2017-07-22___Сънищата-с-Кучетата.docx
Warning: No writable tags set from 2017-07-22___Сънищата-с-Кучетата.docx
    0 image files updated
    1 image files unchanged


I tried also exiftool -d "%Y-%m-%d___Сънищата-с-Кучетата.docx" "-filemodifydate<filename" "2017-07-22___Сънищата-с-Кучетата.docx" and it works, but I need batch command.

Thanks!

StarGeek

The problem is that there aren't enough digits.  The FileModifyDate needs date and time data.  Additionally, the -d isn't needed.

Try something like
exiftool "-filemodifydate<$filename 00:00:00" /path/to/files/
* 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).

marto2013

Thank you, but It did not work out  :'(

PS D:\Documents\Personal\Dreams> exiftool "-filemodifydate<$filename 00:00:00" "2017-07-22___Сънищата-с-Кучетата.docx"
Warning: No writable tags set from 2017-07-22___Сънищата-с-Кучетата.docx
Warning: Invalid tag name '00:00:00' - 2017-07-22___Сънищата-с-Кучетата.docx
    0 image files updated
    1 image files unchanged


EDIT:
I found a command that worked :D

exiftool '-filemodifydate<${filename;/(\d{4}\D?\d{2}\D?\d{2})/;$_=$1} 00:00:00' "*"

(I get it from there: https://exiftool.org/forum/index.php?topic=10473.msg55290#msg55290)

StarGeek

That would have been my next suggestion :)

But it's strange that my command didn't work for you.  I changed a file to have the same name as yours and ran my command and it worked for me.  I did have to run it on the directory and not the file name because I couldn't get either Powershell or CMD to display Cyrillic characters.
* 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).

marto2013

I tried your command with CMD and it worked.. after that I tried it again with PowerShell and it did not work out. That's strange...

With CMD: https://i.imgur.com/yggr5aS.png
With PowerShell: https://i.imgur.com/23zJHJP.png

StarGeek

I believe that PowerShell works more like Linux bash/Mac Terminal with regards to quotes.  If you change the double quotes to single quotes, I think it would work.

What code page are you using?  Type chcp to see what it is.
* 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).

marto2013

QuoteWhat code page are you using? Type chcp to see what it is.
My code page is 65001.

QuoteI believe that PowerShell works more like Linux bash/Mac Terminal with regards to quotes. If you change the double quotes to single quotes, I think it would work.
Thank you very much! I didn't know that. With single quotes, it works ;D

StarGeek

Quote from: marto2013 on May 24, 2020, 01:12:12 PM
My code page is 65001.

Heh, this is the reason I get so annoyed with Windows.  I also set my code page to 65001 and I still couldn't get Cyrillic characters to display properly.
* 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).

Phil Harvey

As well as setting a code page that supports the characters, the font you are using must also support these characters.

- 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

Yeah, I've tried both Lucida Console and Courier New, both support Cyrillic when I use them in other programs.  I just can't seem to get it to work in PS or the new Windows Terminal.  They display correctly in CMD, though. 

My system is weird :P
* 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).