1

I'm looking to use Python to iterate through all the files in a folder and run the exiftool command on each file, so in the end I should have x amount of files each with their own exiftool output to run grep commands on.

Currently I have this code (I made it from pseudocode I took down whilst at a lecture, so it's probably not that accurate)

#!/usr/bin/python  
import os
import subprocess
import sys
for root,dirs,files in os.walk(".", topdown=False):
    for name in files:
        print("echo", os.path.join(root, name))
        subprocess.call(["exiftool", os.path.join(root, name)])
jonrsharpe
  • 107,083
  • 22
  • 201
  • 376

1 Answers1

0

If you're already using python, you could simply use an existing Python library that allows you to read Exif tags, and avoid all error-prone parsing.

Marcus Müller
  • 31,250
  • 4
  • 47
  • 86