Cake sevenzip: how to ignore full path in zip file #4104
Unanswered
ksvenkatesan77
asked this question in
Extension Q&A
Replies: 1 comment 4 replies
-
@ksvenkatesan77 this behavior is standard for 7zip. All files are added either with their relative or absolute path, as seen from the working directory. If you do not want to have any path added to the output, you'd need to specify the working directory, using So, your code should be look something like this: var source = _context.File(fileUpdate.Source).Path;
SevenZip(m => m
.InUpdateMode()
.WithArchive(_context.File(fileUpdate.Destination))
.WithWorkingDirectory(source.GetDirectory())
.WithFiles(source.GetFilename())
.WithPassword(password)); (Have not tested it, though.) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i tried using sevenzip in a cake file.
alas, it is added the file with full path.
i wanted to ignore the full path and add only the files. are there any ways to do it easily? my code snippet is
_context.SevenZip(m => m .InUpdateMode() .WithArchive(_context.File(fileUpdate.Destination)) .WithFiles(_context.File(fileUpdate.Source)) .WithPassword(password));
Beta Was this translation helpful? Give feedback.
All reactions