0
votes

i need to create a compressed file (rar, gz, or other witch supports large files and large compressed file). I need to create folders and add files separated by folders. Example: I have a folders structure like this

Folder 1
  Folder 1.1
  Folder 1.2
  Folder 1.3
Folder 2
  Folder 2.1
    Folder 2.1.1

in each folder i have some files. I need to replicate the structure in a compressed file The zip compress aparently has some limitations, as file size and compressed file size. I have tried with GZipStream, but i not discovered how to create folders inside gz file.

1
gzip is a bytestream compressor, it does not support folders. You need to use something like zip. - leppie
the compression may be in tar.gz or another, not necessarily gzip. Zip may be problematic because has limitations. - Alexandre Heinen

1 Answers

1
votes

GZIP can only compress streams (hence the name GZipStream). That's why gzip is often used together with tar (like .tar.gz files), where tar creates an archive out of the folder structure and gzip compresses that archive.

If you can't use either ZipArchive or ZipFile (in System.IO.Compression.FileSystem) for your purposes, your best bet would be an external library/package, like SharpZipLib or SharpCompress.