Advertisement
Neener

Copy images from a list

Mar 22nd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import os
  2. import shutil
  3.  
  4. allfiles = ['image1.png', 'image1.png']
  5.  
  6. src = 'root directory'
  7. dest = 'folder on my desktop'
  8.  
  9. for dirpath, subdirs, files in os.walk(src):
  10. for file in files:
  11. try:
  12. shutil.copy(os.path.join(src, file), dest)
  13. except:
  14. print(file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement