Created
October 24, 2017 13:01
-
-
Save madprops/8f7124d85ecdfe75bf5ac81374621c85 to your computer and use it in GitHub Desktop.
Find files that match something in the metadata information and move them to another directory. Useful if you want to move a bunch of files from some artist without descriptive filenames but correct metadata
This file contains 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
import os | |
import shutil | |
import subprocess | |
path = "/some/path" | |
destpath = "/some/other/path" | |
to_match = "Maybe an Artist name" | |
filenames = next(os.walk(path))[2] | |
for fn in filenames: | |
meta = subprocess.getoutput("ffprobe " + path + fn) | |
if to_match in meta: | |
shutil.move(path + fn, destpath + fn) | |
print(fn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment