0

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.

  • As I read it, this is conflating together multiple questions (how to compare file mtimes being one; how to modify the argument list being the other), each of which has already been asked and answered on the site previously. If you disagree -- could you try to draw out a single, specific, nonduplicative question? – Charles Duffy Sep 12 '17 at 15:24
  • (There's also some content that reads like it could be asking about how to invoke a script with multiple arguments "select[ed] in file explorer", but if that's a question, it should be asked **as its own distinct question**, not merged together with something else -- with the specific platform and desktop environment that provides this "File Explorer" front and center in the question). – Charles Duffy Sep 12 '17 at 15:27

0 Answers0