File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 7
7
8
8
# Description : Tests to see if the directory testdir exists, if not it will create the directory for you
9
9
10
- import os # Import the OS module
11
- DirCheck = raw_input ("Please enter directory name to check : " )
10
+ import os # Import the OS Module
11
+ CheckDir = raw_input ("Enter the name of the directory to check : " )
12
12
print
13
- print "There was no directory under the name " + DirCheck
14
- print
15
- print "So, a new directory under the name " + DirCheck + " has been created!"
16
- if not os .path .exists (DirCheck ): # Check to see if it exists
17
- os .makedirs (DirCheck ) # Create the directory
13
+ if os .path .exists (CheckDir ):#Checks if the dir exists
14
+ print "The directory exists"
15
+ else :
16
+ print "No directory found for " + CheckDir #Output if no directory
17
+ print
18
+ os .makedirs (CheckDir )#Creates a new dir for the given name
19
+ print "Directory created for " + CheckDir
You can’t perform that action at this time.
0 commit comments