Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. import glob
  2. from shutil import copy
  3.  
  4. allpdfs = glob.glob("C:/path/*")
  5. validlist = ["item1.pdf", "item2.pdf", "item3.pdf"]
  6.  
  7. for itempath in allpdfs:
  8. item = itempath[8:] # 8 should be replaced with the length (characters) of your path
  9. if item in validlist:
  10. print(item)
  11. copy(itempath, "C:/path-to-new-folder")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement