How do I Zip some files and directories without a root directory in C#?
I'm currently writing a program to automatically side-load apps to a Roku over HTTP. I have successfully written all the software except for the part which zips the source files. The Roku needs to be supplied with a zip file with the source files of the app in the top level of the zips file tree. My first instinct was to use the ZipFile class like ZipFile.CreateFromDirectory(source, output);
. This did compress the files and directories however, it also included the source
directory as the top level of file in the zip. This means that all my source files and directories were not in the top level of file, like the Roku needs.
An other, way I tried to does this is by using the ZipArchive class / extension methods. However, with this I could not add directories to the zip, so this was also not appropriate.
To Get around this on Windows when making the zip file you must select the actual files and directories and then select Send to - Compressed (zipped) folder
and Not do this on the file that contains them (an example of this is shown in bellow:
The Question:
Is there a way to compress files and directories to a zip file in c# where those files and directories will be at the top of the zip's file tree? Any help is appreciated.