c# ZipFile.CreateFromDirectory - the process cannot access the file “path_to_the_zip_file_created.zip” because it is being used by another process

前端 未结 5 1370
礼貌的吻别
礼貌的吻别 2020-12-03 04:22

Basic Code:

string startPath = @\"C:\\intel\\logs\";
string zipPath = @\"C:\\intel\\logs-\" + DateTime.Now.ToString(\"         


        
5条回答
  •  时光取名叫无心
    2020-12-03 05:01

    I had the exact same problem. The workaround is to copy the folder you are zipping to another folder and point CreateFromDirectory there. Don't ask me why this works but it does.

    Directory.CreateDirectory();
    File.Copy();
    ZipFile.CreateFromDirectory(, );
    

提交回复
热议问题