function to check if a file exists

copy the code of file handling / file exists

click here to select all the code