Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, shutil, time
- #Specify filetypes to be copied.
- doc=".rtf", ".txt", ".pdf", ".doc"
- pic=".bmp", ".jpg", ".png", ".tif", ".gif", ".rpg"
- #Specify directories
- my_space="D:/tmp/space"
- my_documents="D:/tmp/space/documents"
- my_pictures="D:/tmp/space/pictures"
- cls="\n" * 100
- def copy_doc():
- pathname=os.path.join(my_space, basename)
- if os.path.isfile(pathname):
- shutil.copy2(pathname, my_documents)
- def copy_pic():
- pathname=os.path.join(my_space, basename)
- if os.path.isfile(pathname):
- shutil.copy2(pathname, my_pictures)
- #Menu
- menu=True
- while menu:
- print """***Copy Mate***\n
- 1. Copy files
- 2. Delete files\n"""
- selection=input("Selection: ")
- if selection==1:
- for basename in os.listdir(my_space):
- if basename.endswith(doc):
- copy_doc()
- if basename.endswith(pic):
- copy_pic()
- if selection==0:
- print "Exiting..."
- time.sleep(2)
- menu=False
- else:
- print "Invalid input\n\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement