def cloneDir(self, oldpath, newpath, name): """Copy a folder node recursively. Note that oldpath and newpath are the paths including the folder to be copied. """ spec = self.fileDict[oldpath] self.addnode(name, newpath, spec) dirs, files = dirList(self.fileDict.keys(), oldpath) files.sort() for f in files: spec = self.fileDict[oldpath + f] self.cloneFile(newpath + f, f, spec) dirs.sort() for d in dirs: self.cloneDir(oldpath + d + '/', newpath + d + '/', d)
def emptyDir(self, path): """Empty the directory node at the given path. """ dirs, files = dirList(self.fileDict.keys(), path.rstrip('/') + '/') for f in (dirs + files): self.delete(joinPath(path, f))