E
E
Eugene2020-12-20 05:31:14
C++ / C#
Eugene, 2020-12-20 05:31:14

What is the best way to export/import a huge number of files to or from one file (C#)?

I have separate folders each containing a file with metadata and a huge number of images (there may be hundreds of thousands). The total size of all folders can be gigabytes, or even tens of gigabytes.
At the user's choice, individual folders or all must be saved to one file.
I tried to save an uncompressed zip archive using the DotNetZip library, but even with the option to use the x64 implementation, processing all files takes a long time and may fail with an error at the end.
The question is, maybe there is some ready-made solution for C # (net framework 4.5), with which I could do such an export / import without inventing unnecessary bicycles? Be sure to be able to get the progress of the export/import. And before importing, you need to extract from this archive file a list of what is there to select the one you need (at the moment, an additional file is added to the zip archive, where this list is recorded).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-12-20
@firedragon

Package

public void Zip(string path)
        {
            // добавить сборку System.IO.Compression.FileSystem
           // добавить сборку System.IO.Compression
            var file = ZipFile.Open(path, ZipArchiveMode.Create);
            // выбираете что там и как повторяете до упора
            var newFile = "";
            file.CreateEntryFromFile(newFile, "NewEntry.txt",CompressionLevel.NoCompression);
        }

The list of files, even through https, without copying the archive, can be unpacked without downloading the entire archive.
https://docs.microsoft.com/ru-ru/dotnet/api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question