Greetings
According to the docs, it is possible to use exiftool -o . '-Directory<DateTimeOriginal' -d %Y/%m/%d dir
to copy all files into a directory hierarchy according to their date.
I assume this means that the hierarchy is created in the same directory as the original files.
If so, is it possible to nominate a target directory for the hierarchy instead of the current one?
Ah! Am I right in saying that the (almost inconspicuous) dot represents the current directory and is where I can put the new path?
No, but good idea.
You do it like this:
exiftool -o . '-Directory<DateTimeOriginal' -d DESTDIR/%Y/%m/%d SOURCEDIR
or this:
exiftool -o . '-Directory<DESTDIR/$DateTimeOriginal' -d %Y/%m/%d SOURCEDIR
Either that, or "cd" to the destination directory and run your original command.
- Phil
Aaaarrrgghhh !!!
As you know, I'm trying to incorporate this into both a wrapper and then an app.
The command line you wrote doesn't recurse the SOURCEDIR and, so far, I can't find where to add that flag.
End Goal - copy files from SOURCEDIR (recursively) to DESTDIR/%Y/%m/%d/
Thanks for your patience with an old dog trying to learn new tricks ;)
And, the old rubber duck consulting strikes again!
No sooner sent that message than sanity prevailed and I simply put the -r first and, lo and behold, everything works ::) 8)
Great!
One last??? thing (at least for this subject); how do I only copy files with a certain extension?
That's the -ext option. eg. -ext jpg
You can add as many of these options as you want to copy more than one type of file.
- Phil
Duurrr. I found that before you replied.
OK, I promise to read the docs a bit more thoroughly before asking my next question
:o ::)
Just to ascertain, the . in the command means what? Does it relate to one of the arguments on either side?
It's a command line standard representation of the current directory. It has no specific relation to arguments on either side. You can use it in any situation where you would type a directory, even for other programs, as it is a function of the command line itself.
Related, two dots represent the parent directory of the current directory.
"-o ." specifies the current directory as the output and causes the file to be copied, but the directory is overridden by writing the Directory tag. See example 11 on the "Writing FileName and Directory" page (https://exiftool.org/filename.html#ex11) for an explanation. (Yes, ExifTool is a bit complicated, but that is the price you pay for the flexibility.)
- Phil
Quote from: StarGeek on August 23, 2018, 12:22:42 PM
It's a command line standard representation of the current directory. It has no specific relation to arguments on either side.
Heheheh. I'm not ashamed to admit to being old enough to have cut my teeth on the MS-DOS command line, so I know all about the dreaded dots ;D
However, in the context of ExifTool, if you dig deep enough into the docs, that dot does have a relation to the
-o that it follows, as long as it, in its turn, is followed by a directory derived from a tag.
Apparently it is there as a dummy in order to allow the derived directory.
Or, at least, that's what the docs say 8)
The -o DIR has a meaning by itself. It specifies the directory/filename for the output file(s). It doesn't have to be followed by anything else. But if the Directory is set by other means, they may take priority as detailed in the example. But -o also has the side effect of copying the file instead of moving it (as mentioned in the -o documentation), and this effect stays even if its directory was overridden. I hope this makes sense.
- Phil