Advertisement
Guest User

Untitled

a guest
Feb 8th, 2017
1,665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import os.path
  4. import time
  5.  
  6. # Infinite loop
  7. while 1:
  8. time.sleep(1)
  9. os.system('clear')
  10. # In0 is user input line to determine which directory to check for (Must use "/root" not "~")
  11. In0 = input("What directory/file would you like to check?: ")
  12. # X is variable that contains returned value - True/False(1/0) for user defined variable "In0"
  13. X = os.path.exists(In0)
  14. Y = "DIRECTORY RETURNED: TRUE"
  15. Z = "DIRECTORY RETURNED: FALSE"
  16. Made = "- DIRECTORY MADE"
  17. y = "OKAY"
  18. n = " - ABORTED"
  19. R = ", REMOVING - "
  20. # If directory exists
  21. if X > 0:
  22. time.sleep(1)
  23. os.system('clear')
  24. # Print Y As defined above
  25. print(Y)
  26. time.sleep(3)
  27. # Asks if we would like to remove the pre-existing directory
  28. In1 = input("Would you like to remove the directory - "+In0+"- Y/N?: ")
  29. if In1 == 'Y' or In1 == 'y':
  30. os.system('clear')
  31. # If YES (Y/y), remove directory
  32. os.rmdir(In0)
  33. print(y,R,In0)
  34. time.sleep(1)
  35. continue
  36. else:
  37. # ELSE
  38. os.system('clear')
  39. # Print y+In0+n as defined above
  40. print(y,R,In0,n)
  41. time.sleep(3)
  42. # ELSE Continue loop from start
  43. continue
  44.  
  45. # If directory does not exist
  46. else:
  47. time.sleep(1)
  48. os.system('clear')
  49. # Asks if we would like to make a new directory
  50. print(Z)
  51. In1 = input("Would you like to make a new directory - "+In0+" - Y/N?: ")
  52. if In1 == 'Y' or In1 == 'y':
  53. # If YES (Y/y), Make the new directory as defined by In0
  54. os.system('clear')
  55. os.mkdir(In0)
  56. time.sleep(1)
  57. os.system('clear')
  58. # Print y+In0+Made as defined above
  59. print(y,In0,Made)
  60. time.sleep(3)
  61. # Continue main loop from start
  62. continue
  63. # Otherwise
  64. else:
  65. os.system('clear')
  66. # Print y+In0+n as defined above
  67. print(y,In0,n)
  68. time.sleep(3)
  69. # Continue main loop from start
  70. continue
  71. continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement