I am aware that a few years have passed. (9) However I would like to renew this questions. As I would like to know what is the workaround to make it possible to write in a folder with already some content in it without emptying it first.
Thanks a lot in advance.
Well, the error above occurs because you're trying to overwrite the directory, and it's not empty. There are two basic solutions, and they want you to explicitly pick one, rather than picking one for you and hoping it's right. The choices are: (a) delete everything in the directory and make a new one, or (b) leave the existing contents as they are, and write new files within the directory. It sounds like you want option (b). To do that, you need to move down one level in the directory hierarchy. Don't try to copy the directory itself. Instead, copy each file within the directory. If tthe file you're copying has the same name as an existing file, you have the additional choice of whether you want to overwrite the existing file, append to it, skip that file, or throw an error. That's up to you, depending on your requirements.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com