I have a recursive function that pulls in a large amount of data to a local store. The data comes in just fine and is displayed in my app. The problem is that I have added an upgrade function to my code that renames the data directory then imports the directory again (thus changing the data to the newly formatted data). No problems here either. I then attempt to remove the temp directory that I originally renamed. In comes the problem: I can delete all nodes and branches EXCEPT for the very deepest level on the last top-level subdirectory that is imported. All files within the directory are removed, however, the directory reports (when I pause operations just before the delete and attempt to remove it manually) that the directory is still in use.
I transverse the directories the same way in the import function as I do in my removedir function. Basically, I read all the files in and, if it is a directory, I recurse down a level and process that directory before popping back out.
I have added debugging messages in the form of MessageBox's into my code that shows me that the directory is being released via FindClose. Also, find close does not report an error.
What am I missing here?