Problem with zip c#

xirosxvi

Client
Регистрация
24.09.2019
Сообщения
20
Благодарностей
0
Баллы
1
Hello,

I found this code on the zennoposter forum, but the problem is that it works partially or I make a mistake.

C#:
string startPath = @project.Variables["acces_zip"].Value;

string zipPath = @project.Variables["acces_zip_2"].Value;

System.IO.Compression.ZipFile.CreateFromDirectory(startPath, zipPath);
the two variables are the paths (path 2 ends with.zip)

The problem I currently have is that it does not take the folders that are present in the folder I want to zip.

Example :

folder to be zipped
inside there is:
folder1
folder2
file1.php
file2.php

only the files are zipped, and the folders are ignored.
Do you have any idea?

Thanks you
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Hello,

I found this code on the zennoposter forum, but the problem is that it works partially or I make a mistake.

C#:
string startPath = @project.Variables["acces_zip"].Value;

string zipPath = @project.Variables["acces_zip_2"].Value;

System.IO.Compression.ZipFile.CreateFromDirectory(startPath, zipPath);
the two variables are the paths (path 2 ends with.zip)

The problem I currently have is that it does not take the folders that are present in the folder I want to zip.

Example :

folder to be zipped
inside there is:
folder1
folder2
file1.php
file2.php

only the files are zipped, and the folders are ignored.
Do you have any idea?

Thanks you
If You develop in C# I would suggest using some learning before.
For example about your method you can read there: https://docs.microsoft.com/en-us/dotnet/api/system.io.compression.zipfile.createfromdirectory?view=netframework-4.8
If I'm not mistaken You have to add more parameters to this method to compress sub-dirs
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)