33 from __future__
import absolute_import
34 from __future__
import print_function
58 if args[0] ==
'-h' or args[0] ==
'--help' :
64 elif args[0][0] ==
'-':
65 print(
'Unknown option %s' % args[0])
69 print(
'Too many arguments.')
80 filename = sys.argv[0]
81 file =
open(filename,
'r') 85 for line
in file.readlines():
86 if line[2:10] ==
'mkdir.py':
88 elif line[0:6] ==
'######' and doprint:
92 print(line[2:], end=
' ')
106 while len(dir) > 1
and dir[-1] ==
'/':
113 print(
'mkdir asked to make directory \'/\'.')
124 print(
'Directory %s already exists.' % dir)
132 print(
'Directory %s doesn\'t exist.' % dir)
136 parent = os.path.dirname(dir)
137 mkdir(parent, verbose)
145 print(
'Making directory %s' % dir)
149 print(
'Caught exception from Ifdh.mkdir for directory %s.' % dir)
165 while len(dir) > 1
and dir[-1] ==
'/':
178 parent = os.path.dirname(dir)
179 base = os.path.basename(dir)
182 contents = Ifdh.ls(parent, 1)
189 for content
in contents:
193 if len(content) > 1
and content[-1] ==
'/':
197 if os.path.basename(content[:-1]) == base:
207 if __name__ ==
"__main__":
int open(const char *, int)
Opens a file descriptor.
def existdir(dir, verbose)