Created
July 14, 2025 17:11
-
-
Save PierceLBrooks/feb53b0396a6fba58b29894f961650be to your computer and use it in GitHub Desktop.
exifsplit.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Pierce Brooks | |
import os | |
import shutil | |
import subprocess | |
for root, folders, files in os.walk(os.getcwd()): | |
for name in files: | |
path = os.path.join(root, name) | |
command = [] | |
command.append("exiftool") | |
command.append(path) | |
language = "" | |
try: | |
output = subprocess.check_output(command) | |
output = str(output.decode("UTF-8")) | |
lines = output.split("\n") | |
for line in lines: | |
line = line.strip() | |
if (line.startswith("Media Language Code")): | |
line = line.split(":") | |
language += line[len(line)-1].strip().replace("/", "_").replace(";", "_").replace(":", "_") | |
break | |
except: | |
language = "" | |
if (len(language) == 0): | |
language += "und" | |
os.makedirs(os.path.join(os.getcwd(), language), exist_ok=True) | |
shutil.copy2(path, os.path.join(os.getcwd(), language, name)) | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment