make_folder.py 913 B

123456789101112131415161718192021222324252627
  1. import os
  2. def make_folder(dealername):
  3. os.getcwd()
  4. #'C:\\Users\\corcoras\\Desktop\\FY14 INSTALLS'
  5. install_dir = 'C:\\Users\\corcoras\\Desktop\\FY14 INSTALLS'
  6. os.chdir(install_dir)
  7. #dealername = "Rene motors"
  8. dealername_no_space = dealername.replace(" ", "_")
  9. dealername_no_space
  10. #'Don_Ayres_Honda'
  11. dealer_folder = dealername_no_space[:1]
  12. dealer_folder
  13. #'D'
  14. os.chdir(dealer_folder)
  15. os.getcwd()
  16. #'C:\\Users\\corcoras\\Desktop\\FY14 INSTALLS\\D'
  17. dealername_spaces = dealername_no_space.replace("_", " ")
  18. dealername_spaces
  19. #'Don Ayres Honda'
  20. os.mkdir(dealername_spaces)
  21. os.chdir(dealername_spaces)
  22. os.getcwd()
  23. #'C:\\Users\\corcoras\\Desktop\\FY14 INSTALLS\\D\\Don Ayres Honda'
  24. os.mkdir("config")
  25. os.mkdir("original")
  26. os.mkdir("final")
  27. print(f"\nFolder was created : {install_dir}\{dealer_folder}\{dealername_spaces}")