I am running sevenzipsharp on various archives and if it passes my test I'd like to move the archive into another folder. However I get an exception saying the file is in use by a process. I can't move it either in windows explorer however when i kill my app process I can move it. I suspect sevenzipsharp has a lock on the file so I can't move it.
I write using (var extractor= new SevenZipExtractor(fn)) {
. I tried moving the file outside the using block and still no go. It seems that after I run this method a few times I can move the first archive but than I won't be able to move the last archive
How do I make it so no process is using the file so I can move the archive to a folder?
Just dispose() this object and don't use using(.... ) I don't know why(!) but this method worked for me.
But if archive is not valid, it will be remain locked... Any suggestion?
UPDATE: There is a better way. You can make a Stream for your file and close() it at end of your code.