def dirtool(operation, directory):
operation = operation.lower()
import os
if operation == 'exists':
return bool(os.path.exists(directory))
elif operation == 'create':
if os.path.exists(directory):
raise RuntimeError('An Error Has Occured: Directory Already Exists (0007)')
else:
os.makedirs(directory)
elif operation == 'delete':
if os.path.exists(directory):
os.rmdir(directory)
else:
raise RuntimeError('An Error Has Occured: Directory Doesn\'t Exist (0009)')
else:
raise RuntimeError('An Error Has Occured: Invalid Operation Entered (0008)')
# Download A File
评论列表
文章目录