Remove an existing file from fsdb.
           File with the given digest will be removed from fsdb and
           the directory tree will be cleaned (remove empty folders)
         Args:
            digest -- digest of the file to remove

def remove(self, digest):
        """Remove an existing file from fsdb.
           File with the given digest will be removed from fsdb and
           the directory tree will be cleaned (remove empty folders)
         Args:
            digest -- digest of the file to remove
        """
        # remove file
        absPath = self.get_file_path(digest)
        os.remove(absPath)

        # clean directory tree
        tmpPath = os.path.dirname(absPath)
        while tmpPath != self.fsdbRoot:
            if os.path.islink(tmpPath):
                raise Exception('fsdb found a link in db tree: "{0}"'.format(tmpPath))
            if len(os.listdir(tmpPath)) > 0:
                break
            os.rmdir(tmpPath)
            tmpPath = os.path.dirname(tmpPath)

        self.logger.debug('Removed file: "{0}" [{1}]'.format(absPath, digest))