Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, shutil
- path = "C:/Users/amady/Downloads/"
- toExe = path + "exe_and_msi/"
- toVideos = path + "videos/"
- toAudio = path + "audio/"
- toImages = path + "images/"
- toTorrents = path + "torrents/"
- toZip = path + "zip/"
- toDocuments = path + "documents/"
- toJar = path + "jar/"
- toIso = path + "iso/"
- def move(place, f):
- src = path + f
- dst = place + f
- shutil.move(src, dst)
- os.chdir("C:/Users/amady/Downloads")
- for f in os.listdir():
- fileExtension = os.path.splitext(f)[1].split(' ')[0]
- if fileExtension in [".exe", ".msi"]:
- move(toExe, f)
- elif fileExtension in [".mp4", ".avi", ".AVI", ".MOV", ".mov"]:
- move(toVideos, f)
- elif fileExtension == ".torrent":
- move(toTorrents, f)
- elif fileExtension in [".mp3", ".wav"]:
- move(toAudio, f)
- elif fileExtension in [".png", ".jpg", ".nef", ".jpeg"]:
- move(toImages, f)
- elif fileExtension == ".zip":
- move(toZip, f)
- elif fileExtension in [".docx", ".doc", ".ppt", "pptx"]:
- move(toDocuments, f)
- elif fileExtension == ".jar":
- move(toJar, f)
- elif fileExtension == ".iso":
- move(toIso, f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement