+doc
This commit is contained in:
@@ -28,12 +28,14 @@ def can_access_directory(destinationDirectory):
|
|||||||
return os.access(destinationDirectory, os.R_OK | os.W_OK | os.X_OK)
|
return os.access(destinationDirectory, os.R_OK | os.W_OK | os.X_OK)
|
||||||
|
|
||||||
def makedirs(destinationDirectory):
|
def makedirs(destinationDirectory):
|
||||||
|
'''recursive directory creation function'''
|
||||||
try:
|
try:
|
||||||
os.makedirs(destinationDirectory)
|
os.makedirs(destinationDirectory)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def chmod(sourceFile, mode = 0755):
|
def chmod(sourceFile, mode = 0755):
|
||||||
|
'''change the mode of sourceFile to the mode'''
|
||||||
for file in glob.glob(sourceFile):
|
for file in glob.glob(sourceFile):
|
||||||
os.chmod(file, mode)
|
os.chmod(file, mode)
|
||||||
|
|
||||||
@@ -47,6 +49,7 @@ def unlinkDir(sourceDirectory):
|
|||||||
print "unlinkDir: remove failed..."
|
print "unlinkDir: remove failed..."
|
||||||
|
|
||||||
def move(sourceFile, destinationFile):
|
def move(sourceFile, destinationFile):
|
||||||
|
'''recursively move a sourceFile or directory to destinationFile'''
|
||||||
shutil.move(sourceFile, destinationFile)
|
shutil.move(sourceFile, destinationFile)
|
||||||
|
|
||||||
def touch(sourceFile):
|
def touch(sourceFile):
|
||||||
@@ -54,6 +57,7 @@ def touch(sourceFile):
|
|||||||
os.utime(file, None)
|
os.utime(file, None)
|
||||||
|
|
||||||
def cd(directoryName = ''):
|
def cd(directoryName = ''):
|
||||||
|
'''change directory'''
|
||||||
current = os.getcwd()
|
current = os.getcwd()
|
||||||
if directoryName:
|
if directoryName:
|
||||||
os.chdir(directoryName)
|
os.chdir(directoryName)
|
||||||
@@ -61,6 +65,7 @@ def cd(directoryName = ''):
|
|||||||
os.chdir(os.path.dirname(current))
|
os.chdir(os.path.dirname(current))
|
||||||
|
|
||||||
def ls(sourceDirectory):
|
def ls(sourceDirectory):
|
||||||
|
'''listdir'''
|
||||||
return os.listdir(sourceDirectory)
|
return os.listdir(sourceDirectory)
|
||||||
|
|
||||||
def export(key, value):
|
def export(key, value):
|
||||||
|
|||||||
Reference in New Issue
Block a user