Used a new function to check for the existance of a directory which no
longer relies on the creation of a file. It is faster and creates
nothing to clean up after.