Beispiel #1
0
 def empty(self):
     if self.exists:
         for root, dirs, files in walk(self.path):
             for d in dirs[:]:
                 if not d.startswith(('.', '_')):
                     Directory(abspath(root, d)).rm()
                 
                 dirs.remove(d)
             
             for f in files:
                 if not f.startswith(('.', '_')):
                     File(abspath(root, f)).rm()
Beispiel #2
0
 def __init__(self, path):
     self.path = abspath(path)
     
     if self.is_root:
         raise FileSystemException('Root is not an acceptible directory.')
Beispiel #3
0
 def __init__(self, path, content = None):
     self.path = abspath(path)
     self.root = Directory(op.dirname(self.path))
     self.name, self.extension = op.splitext(op.basename(self.path))
     self.content = content