Added try/catch for removedirectory