Advertisement
Guest User

python

a guest
Dec 25th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. import shutil
  2. import os
  3.  
  4. IgnoreFileTypes = 'txt,nfo,sfv,dat,htm,html'
  5. ZipFileTypes = 'rar,zip,7z,r0'
  6. FileName = ''.join(eg.event.payload)
  7. FileExtension = FileName[-3:]
  8. isFolder = os.path.isdir(FileName)
  9. DestFolder = 'J:\\DL\\movieproc\\'
  10. g, h = os.path.splitext(FileName)
  11. j = os.path.basename(g)
  12. os.mkdir(DestFolder+j+'\\')
  13. if isFolder == True:
  14.     for root, dirs, files in os.walk(FileName):
  15.         for f in files:
  16.             if ZipFileTypes.find(f[-3:]) != -1:
  17.                 shutil.copytree(FileName,os.path.join('J:\\DL\\moviezip\\',os.path.basename(FileName)))
  18.                 print FileName + ' copied.'
  19.             elif IgnoreFileTypes.find(f[-3:]) == -1 and ZipFileTypes.find(f[-3:]) == -1:
  20.                 shutil.copy(root+'\\'+f,DestFolder+j+'\\')
  21.                 print DestFolder + j + ' copied.'
  22. if isFolder == False and IgnoreFileTypes.find(FileExtension) == -1:
  23.     shutil.copy(FileName,'J:\\DL\\movieproc\\')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement