htnawsaj

Movemediafiles

Jan 6th, 2014
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. import os
  2. import shutil
  3.  
  4. mediapath = ['/storage/emulated/0/Download','/storage/emulated/0/Pictures/reddit_sync','/storage/emulated/0/FalconPro/SavedPics']
  5. filestomove = []
  6.  
  7.  
  8. def copyfile(paths):
  9.     for item in paths:
  10.         if 'jpg' in item:
  11. ##            print file
  12.             shutil.move(item,'/storage/emulated/0/Pictures/Pics')
  13.         elif 'gif' in item:
  14.             shutil.move(item,'/storage/emulated/0/Pictures/Gif')
  15.  
  16. def getfileslist(dir):
  17.     fileswithpath = []
  18.     files = os.listdir(dir)
  19.     for item in files:
  20.         fileswithpath.append(dir +'/'+ item)
  21.     return fileswithpath
  22.  
  23.  
  24. for item in mediapath:
  25.     filestomove = getfileslist(item)
  26.     copyfile(filestomove)
Advertisement
Add Comment
Please, Sign In to add comment