Copy folder contents to a created .zip file: 'file not found or no read permissions'

戏子无情 提交于 2019-11-28 11:42:29

I encountered the same problem (file not found or no read permissions' even though I have read/write privileges on the file according to the value of my file.attributes property). The problem disapeared as soon as I found and suppress a 0 length file somewhere in the directory to be copied with the copyhere method.

As Raymond said, the problem was that I had an open reference to the .zip folder in the file variable that I created (which had a lock on the folder so I could not copy any contents to it). The solution is to call

file.Close();

after writing to the file, that way we can access the file to copy contents to it :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!