3
I am using dotnetzip to zip a file but the zip file takes the directory root of the file, wanted to zip only the file without the directories:
public static void Zipar(FileInfo file)
{
using (ZipFile zip = new ZipFile())
{
zip.Password = "******";
zip.AddFile(file.FullName);
zip.Save(file.FullName.Replace(file.Extension,".zip"));
}
}
Inside the zip file it looks like this: \pasta\pasta\arquivo.txt
I wanted it to stay that way: arquivo.txt
I was trying to zip with password and it was not working, until I realized that it only puts password if the file is not empty, in my case it generated the file then zipped more to test, the program n put the data to save time in the tests, so I find it interesting to say this to anyone who goes through something like this.
– Andeton Feitosa