예제 #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