コード例 #1
0
    def delete_directory(path, conditions=None):
        if not all([c(path) for c in conditions]):
            return False

        try:
            shutil.rmtree(path)
            return True
        except Exception, ex:
            Log.Warn('Unable to remove directory %r - %s', path, ex, exc_info=True)
コード例 #2
0
    def delete_file(path, conditions=None):
        if not all([c(path) for c in conditions]):
            return False

        try:
            os.remove(path)
            return True
        except Exception, ex:
            Log.Warn('Unable to remove file %r - %s', path, ex, exc_info=True)
コード例 #3
0
    def delete_directory(path, conditions=None):
        if not all([c(path) for c in conditions]):
            return False

        try:
            shutil.rmtree(path)
            return True
        except Exception as ex:
            Log.Warn('Unable to remove directory %r - %s', path, ex, exc_info=True)

        return False
コード例 #4
0
    def delete_file(path, conditions=None):
        if not all([c(path) for c in conditions]):
            return False

        try:
            os.remove(path)
            return True
        except Exception as ex:
            Log.Warn('Unable to remove file %r - %s', path, ex, exc_info=True)

        return False