Handling Files And Directory Errors Files and directory errors fall into the following categories. Missing config file - have the application support hard-coded defaults for this case, possibly creating a new config file for the next run. Missing directories - be prepared to create them when needed. Also be prepared for a file placed where you expect a directory to be. Bad permissions/ownership - make sure where the bad permissions are set - on the file? or its containing directory? on the directory containing it? in such a case, don't try to fix this - give a proper error message.