forked from geekcomputers/Python
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdir_test.py
More file actions
Latest commit
19 lines (17 loc) · 629 Bytes
/
Copy pathdir_test.py
File metadata and controls
19 lines (17 loc) · 629 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Script Name : dir_test.py
# Author : Craig Richards
# Created : 29th November 2011
# Last Modified :
# Version : 1.0
# Modifications :
# Description : Tests to see if the directory testdir exists, if not it will create the directory for you
importos#Import the OS Module
CheckDir=raw_input("Enter the name of the directory to check : ")
print
ifos.path.exists(CheckDir):#Checks if the dir exists
print"The directory exists"
else:
print"No directory found for "+CheckDir#Output if no directory
print
os.makedirs(CheckDir)#Creates a new dir for the given name
print"Directory created for "+CheckDir