Hi,
tried without success a command from
https://exiftool.org/forum/index.php?topic=5517.msg26707#msg26707
to extract the datetimeoriginal from the foldername.
ikke@LM-ssd:~/Schreibtisch/19720612 test$ exiftool '-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' .
Warning: No writable tags set from ./IMG_20220612_155725058.jpg
Warning: No writable tags set from ./IMG_20220612_155714202.jpg
Warning: No writable tags set from ./IMG20220611170557.jpg
Warning: No writable tags set from ./IMG20220612141948.jpg
Warning: No writable tags set from ./IMG20220612152050.jpg
1 directories scanned
0 image files updated
5 image files unchanged
but the tags are in the files.
ikke@LM-ssd:~/Schreibtisch/19720612 test$ exiftool -time:datetimeoriginal -s '.'
======== ./IMG_20220612_155725058.jpg
DateTimeOriginal : 2022:06:12 15:57:26
======== ./IMG_20220612_155714202.jpg
DateTimeOriginal : 2022:06:12 15:57:15
======== ./IMG20220611170557.jpg
DateTimeOriginal : 2022:06:11 17:05:57
======== ./IMG20220612141948.jpg
DateTimeOriginal : 1955:05:05 04:04:04
======== ./IMG20220612152050.jpg
DateTimeOriginal : 2022:06:12 15:20:50
1 directories scanned
5 image files read
and this command works.
ikke@LM-ssd:~/Schreibtisch/19720612 test$ exiftool -datetimeoriginal='2001-12-04 04:04:04' .
1 directories scanned
5 image files updated
I use Linux Mint 20.3. Any idea what the issue is?
You're using a dot to indicate the current directory. In doing so, the only directory info that exiftool has is that dot. When you look at the output of a command like
exiftool -Directory .
The only output you'll see is
Directory : .
The solution is to use a more complete directory path. One that only includes the numbers that will be used for the date. For example
exiftool '-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' '~/Schreibtisch/19720612 test/'
This forum is really amazing. Although it has been around for years (decades), simple questions are answered immediately.
Using the CL sucks. I also had to replace the tilde.
exiftool '-datetimeoriginal<${directory} ${datetimeoriginal;s/.* //}' '/home/ikke/Schreibtisch/19720612 test/'
Do I understand correctly that the dot is a Linux placeholder for the current directory and perl has a problem with that?
Is there a corresponding placeholder in perl?
Quote from: keysnapper on June 14, 2022, 05:49:22 AM
Do I understand correctly that the dot is a Linux placeholder for the current directory and perl has a problem with that?
No, the dot
is the current directory (two dots is the parent directory), not a placeholder. It is a Relative Path. This is standard across Windows, Linux, and Mac. But if you pass just the dot, then then only directory path that exiftool has is just that dot. Exiftool has the
FilePath tag that will cause exiftool to figure out the Absolute Path, but that is not extracted by default (see Notes for this tag on the Extra tags page (https://exiftool.org/TagNames/Extra.html)).
You could use the
FilePath tag instead of directory, but that would require some extra work as the
FilePath tag includes the filename.
Example of the three file name and path tags using just the dot for the current directory and the full path
Y:\!temp\ccc>exiftool -G -a -s -Directory -Filename -FilePath .
======== ./File_1.jpg
[File] Directory : .
[File] FileName : File_1.jpg
[File] FilePath : Y:/!temp/ccc/File_1.jpg
======== ./File_2.jpg
[File] Directory : .
[File] FileName : File_2.jpg
[File] FilePath : Y:/!temp/ccc/File_2.jpg
======== ./File_3.jpg
[File] Directory : .
[File] FileName : File_3.jpg
[File] FilePath : Y:/!temp/ccc/File_3.jpg
1 directories scanned
3 image files read
Y:\!temp\ccc>exiftool -G -a -s -Directory -Filename -FilePath Y:\!temp\ccc
======== Y:/!temp/ccc/File_1.jpg
[File] Directory : Y:/!temp/ccc
[File] FileName : File_1.jpg
[File] FilePath : Y:/!temp/ccc/File_1.jpg
======== Y:/!temp/ccc/File_2.jpg
[File] Directory : Y:/!temp/ccc
[File] FileName : File_2.jpg
[File] FilePath : Y:/!temp/ccc/File_2.jpg
======== Y:/!temp/ccc/File_3.jpg
[File] Directory : Y:/!temp/ccc
[File] FileName : File_3.jpg
[File] FilePath : Y:/!temp/ccc/File_3.jpg
1 directories scanned
3 image files read