Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import glob
- from shutil import copy
- allpdfs = glob.glob("C:/path/*")
- validlist = ["item1.pdf", "item2.pdf", "item3.pdf"]
- for itempath in allpdfs:
- item = itempath[8:] # 8 should be replaced with the length (characters) of your path
- if item in validlist:
- print(item)
- copy(itempath, "C:/path-to-new-folder")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement