I often use exiftool to copy metadata from one file to another.
exiftool -TagsFromFile FILE1[SOURCE] FILE2[TARGET]
I am trying to speed up the workflow and figure out a bash script that would allow me to simply select two files in file explorer - right click on them - open with - thescript.sh
/path/to/thescript.sh $1 $2
As you can see the most important part is to select a right file as the source ($1
) / target ($2
).
Source files often named like this:
20170630_181348_2674.jpg
or 20170630_181348_2674.dng
Target files usually have a suffix added to the name e.g. 20170630_181348_2674_0001.jpg
or 20170630_181348_2674_v2.jpg
So one thing I know for sure is that the source file name is always shorter.
Another thing, the files I use as the source are always older than the ones I copy metadata to.
I was wondering if there is any way in bash to compare inputs ($@
) by their file name or by the file modify date and place them as $1
and $2
accordingly.
Any ideas would be greatly appreciated.