Change method for deleting directories.

Should hopefully stop the intermittant error of it emptying directories and then failing to delete them.
Merge pull request #11 from mavnn/development

Change method for deleting directories.