In [2]:
cd biologydirect-1-1-19/


/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19

In [3]:
!ls


biologydirect-1-1-19-caps.txt  pone.0000224.g001.tif  pone.0000248.g005.tif
biologydirect-1-1-19-jpg.txt   pone.0000235.g002.tif  pone.0000266.g002.tif
pone.0000189.g005.tif	       pone.0000248.g001.tif  pone.0000266.g003.tif
pone.0000189.g006.tif	       pone.0000248.g002.tif
pone.0000204.g006.tif	       pone.0000248.g003.tif

In [4]:
import os,sys,glob

In [5]:
path = "/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/*.tif"

In [6]:
print path


/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/*.tif

In [7]:
import glob, exiftool

In [8]:
for fname in glob.glob(path):
    
    print(fname)


/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000266.g003.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000248.g003.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000204.g006.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000248.g002.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000189.g006.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000224.g001.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000235.g002.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000266.g002.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000248.g001.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000248.g005.tif
/home/ross/workspace/mygithub/Trying-beautiful-soup/biologydirect-1-1-19/pone.0000189.g005.tif

In [13]:
import exiftool

files = ["pone.0000248.g003.tif", "pone.0000248.g002.tif", "pone.0000189.g005.tif"]
with exiftool.ExifTool() as et:
    metadata = et.get_metadata_batch(files)
for d in metadata:
    print("{:21.21} {:50.50}".format(d["SourceFile"],
                                     d["XMP:Description"]))


pone.0000248.g003.tif <p>Haplogroup Q phylogeny. Abbreviations follow <x
pone.0000248.g002.tif <p>Upper Pleistocene macrohaplogroup M phylogeny f
pone.0000189.g005.tif <p>Phylogenetic analysis of PDZ and LIM domains. (

In [ ]:
files = ["pone.0000248.g003.tif", "pone.0000248.g002.tif", "pone.0000189.g005.tif"]
with exiftool.ExifTool() as et:
    metadata = et.get_metadata_batch(files)
for d in metadata:
    print("{:21.21} {:50.50}".format(d["SourceFile"],
                                     d["XMP:Description"]))