ExifTool > Newbies

Warning: garbage at end of string in strptime

(1/2) > >>

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:

--- Code: ---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

--- End code ---

I tried also
--- Code: ---exiftool -d "%Y-%m-%d___Сънищата-с-Кучетата.docx" "-filemodifydate<filename" "2017-07-22___Сънищата-с-Кучетата.docx"
--- End code ---
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/

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

--- Code: ---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

--- End code ---

EDIT:
I found a command that worked :D


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

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

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

Navigation

[0] Message Index

[#] Next page

Go to full version