Delete File in BGE

Hi, i would know how to delete a file that is in the folder of game , while the game is running, i need it very much.
Help me please.:o

This is a common python operation. Please search for “file delete with python”.

I search on internet and i tried with this:

import os

“//” is BGE notation. Python does not know that.

You need to solve the path with bge.logic.expandPath(path) beforehand.

Ok, i tried another time and the error was the path.
This is the correct code:

import os

file = “D:\blender\RTS\RTS.bgeconf”


Better use “expandPath” as Monster suggested which always points to the path of your game files. When using an absolute path the players of your game will have to copy your game exactly into “d:\blender\rts” otherwise it won’t work.