Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # DDSRename
- import os
- import os.path
- print("Enter absolute input path (e.g, \"C:\SortMe\\)\"")
- input_path = input()
- for file in os.listdir(input_path):
- if "#" in file:
- old_path = input_path + file
- extend_path = old_path.replace("#", "\\")
- file_name = extend_path[extend_path.rfind("\\")+1:]
- folder_structure = extend_path[:len(extend_path)-len(file_name)]
- if not os.path.exists(folder_structure):
- os.makedirs(folder_structure)
- os.rename(old_path, extend_path)
Advertisement
Add Comment
Please, Sign In to add comment