Guest User

DDS Rename

a guest
Jun 4th, 2015
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. # DDSRename
  2. import os
  3. import os.path
  4.  
  5. print("Enter absolute input path (e.g, \"C:\SortMe\\)\"")
  6. input_path = input()
  7.  
  8. for file in os.listdir(input_path):
  9.     if "#" in file:
  10.         old_path = input_path + file
  11.         extend_path = old_path.replace("#", "\\")
  12.         file_name = extend_path[extend_path.rfind("\\")+1:]
  13.         folder_structure = extend_path[:len(extend_path)-len(file_name)]
  14.         if not os.path.exists(folder_structure):
  15.             os.makedirs(folder_structure)
  16.         os.rename(old_path, extend_path)
Advertisement
Add Comment
Please, Sign In to add comment