Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def DirectoryCleaner():
- dir = input("Enter absolute path to directory. ")
- extensions = []
- confirm = input("Are you sure you want to execute this task? ")
- if confirm == 'y' and dir:
- print("Sorting {}".format(dir))
- files = os.listdir(dir)
- for file in files:
- ext = os.path.splitext(file)[1]
- if ext not in extensions:
- createExtensionDirectory(dir, ext)
- extensions.append(ext)
- moveFile(dir, file, ext)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement