Thanks you all,
In deed Grandfather gave me exactly what I'm lookin for... I will make sure to provide the right permission operators on the functin call.
Can I apply something similar to check if a certain Directory exists and I also have permissions to create a new file in this Directory?