| 17 | |
| 18 | |
| 19 | def main(): |
| 20 | CheckDir = input("Enter the name of the directory to check : ") |
| 21 | print() |
| 22 | |
| 23 | if os.path.exists(CheckDir): # Checks if the dir exists |
| 24 | print("The directory exists") |
| 25 | else: |
| 26 | print("No directory found for " + CheckDir) # Output if no directory |
| 27 | print() |
| 28 | option = input("Would you like this directory create? y/n: ") |
| 29 | if option == "n": |
| 30 | print("Goodbye") |
| 31 | exit() |
| 32 | if option == "y": |
| 33 | os.makedirs(CheckDir) # Creates a new dir for the given name |
| 34 | print("Directory created for " + CheckDir) |
| 35 | else: |
| 36 | print("Not an option. Exiting") |
| 37 | exit() |
| 38 | |
| 39 | |
| 40 | if __name__ == "__main__": |