A big warning: If you ever try to delete a complete folder this way, never, never yes really NEVER use an empty string for char* dir. It will delete your whole disk in less than 1 minute. You won't recognize this (the only thing you see is that the engine is hanging) and the files can't be restored with Recovery Tools (in my case ).

So be very very carful when using the code above for deleting whole folders.