chenqingyu / auto-sub

Automatically exported from code.google.com/p/auto-sub
0 stars 0 forks source link

filemover version 2 :-) #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
import sys, os, glob, shutil, errno
sourcepath = "/volume1/video/_Series_/"
destpath = "/volume1/video/_Series_ok_/"
os.chdir(sourcepath)
serieList = ['Eureka', 'Castle (2009)', 'Hart of Dixie', 'Modern Family', 'Once 
Upon a Time (2011)', 'Touch (2012)' ]
for serie in serieList:
    sourcepath_serie = sourcepath + serie + "/*/*"
    destpath_serie = destpath + serie
    try:
        os.makedirs(destpath_serie)
    except OSError, e:
        if e.errno != errno.EEXIST:
            print sourcepath_serie
    for file in glob.glob(sourcepath_serie):
        if file[len(file)-7:] == ".nl.srt":
            print file[0:len(file)-7]
            for name_zkr in glob.glob(sourcepath_serie):
                if name_zkr[0:len(name_zkr)-4] == file[0:len(file)-7]:
                    shutil.move(name_zkr, destpath_serie)
                if name_zkr[0:len(name_zkr)-5] == file[0:len(file)-7]:
                    shutil.move(name_zkr, destpath_serie)
                if name_zkr[0:len(name_zkr)-6] == file[0:len(file)-7]:
                    shutil.move(name_zkr, destpath_serie)
                if name_zkr[0:len(name_zkr)-7] == file[0:len(file)-7]:
                    shutil.move(name_zkr, destpath_serie)
                if name_zkr[0:len(name_zkr)-8] == file[0:len(file)-7]:
                    shutil.move(name_zkr, destpath_serie)
                if name_zkr[0:len(name_zkr)-9] == file[0:len(file)-7]:
                    shutil.move(name_zkr, destpath_serie)

Original issue reported on code.google.com by sikke...@gmail.com on 13 Jul 2012 at 4:31

GoogleCodeExporter commented 9 years ago
And what's the issue here?

Original comment by nielswij...@gmail.com on 13 Jul 2012 at 6:29

GoogleCodeExporter commented 9 years ago
Thanks for sharing this. Could you upload it as a file? Than I can post it on 
the wiki.

Original comment by romke.va...@gmail.com on 13 Jul 2012 at 6:34

GoogleCodeExporter commented 9 years ago
This .py one should work :-)

Original comment by sikke...@gmail.com on 14 Jul 2012 at 6:17

Attachments:

GoogleCodeExporter commented 9 years ago
Added to the wiki

Original comment by romke.va...@gmail.com on 20 Sep 2012 at 2:49