Hello everyone,
How can I create listview selected each images create as a Zip file?
Now error occured.
'Access to the path 'c:\example' is denied.'
- string FileName = @"c:\example";
- if (Directory.Exists(FileName))
- {
- foreach (Tble_Documents item in listView1.SelectedItems)
- {
- string[] files = Directory.GetFiles(System.IO.Path.GetDirectoryName(item.Fullname), "*.jpg");
-
- using (FileStream zipToOpen = new FileStream(FileName, FileMode.Open)) /*Here occurring that error*/
- {
- using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Create))
- {
- foreach (var file in files)
- {
- archive.CreateEntryFromFile(file, file);
- }
-
- }
- }
- }
- }