32 from __future__
import absolute_import
33 from __future__
import print_function
58 if args[0] ==
'-h' or args[0] ==
'--help' :
67 elif args[0][0] ==
'-':
68 print(
'Unknown option %s' % args[0])
72 print(
'Too many arguments.')
85 filename = sys.argv[0]
86 file =
open(filename,
'r') 90 for line
in file.readlines():
91 if line[2:13] ==
'emptydir.py':
93 elif line[0:6] ==
'######' and doprint:
97 print(line[2:], end=
' ')
108 while len(dir) > 1
and dir[-1] ==
'/':
115 files = Ifdh.ls(dir, 1)
118 print(
'Caught exception from Ifdh.ls for directory %s.' % dir)
128 print(
'Deleting %s' % file)
132 print(
'Caught exception from Ifdh.rm for file %s.' % file)
150 if subdir[-1] ==
'/':
151 if not first
or os.path.basename(subdir[:-1]) != os.path.basename(dir):
152 rmdir(subdir[:-1], verbose)
162 while len(dir) > 1
and dir[-1] ==
'/':
167 print(
'Deleting directory %s' % dir)
171 print(
'Caught exception from Ifdh.rmdir for directory %s.' % dir)
176 if __name__ ==
"__main__":
def emptydir(dir, verbose)
int open(const char *, int)
Opens a file descriptor.