Fanart finder
#1
hey I've been a lurker on this forum for a bit now and i thought i would share a python script i made. I use this script to find the fanart in my tv or movie folder and the script then copies and renames the fanart for me to a different directory, i then use this other directory for aeon backgrounds. I'm only new at python so there might be some errors in it.

Download .py and .exe (made with py2exe) here.

known issues:
  • only goes down one subdirectory

future plans:
  • add option to convert file to a different format (eg .bmp)
  • create GUI

Code:
#!/usr/bin/env python 2.7
import os
import shutil
print """this will find files with a common name in a directory and move them to a new folder, it will also rename the file to the name of the folder. eg fanart.jpg will be babalon5.jpg if the folder it was in was called babylon5 \n"""
dir_path = raw_input("folder of where the files are eg C:\\tree\n") + "\\"
new_folder = raw_input("Folder you will be moving the files to. Eg. C:\\fanart\n") + "\\"
file_name= raw_input("the common file name you wish to move. Eg fanart (do not include the extension)\n")
file_extension = raw_input("The extension of the file you are copying\n")
def print_dir(dir_path):
    for name in os.listdir(dir_path):
        find_fan=os.path.join(dir_path,name,file_name + file_extension)
        print (find_fan)
        if os.path.isfile(find_fan):
            shutil.copy (find_fan, "%s\%s%s" % (new_folder, name, file_extension))
        else:
            print "%s not moved" % name

print_dir(dir_path)
Reply

Logout Mark Read Team Forum Stats Members Help
Fanart finder0