How to Create a ZIP File

How to Create a ZIP File

Zipping a file, folder, or multiple files and folders lets you compress their size before transferring them to other devices. You may also zip files/folders so they take up lesser disk space. Popular operating systems, including Windows and Mac OS, provide you with the feature of zipping files. Various online zipping tools are also available that you can use in your browser. So let’s take a look at how to create a ZIP file in different cases.

Create a ZIP File Online

There could be the case when your files are hosted on a cloud storage such as Google Drive, Dropbox, or OneDrive. In such a case, it is convenient to create ZIP files online using Aspose’ free zipping tool, which is shown below. It provides you with the easiest, user-friendly, and powerful solution to make ZIP files.

This free online zipping tool lets you create ZIP files quickly and easily. To ensure your privacy and protect your files, it deletes the input and output files from server after 24 hours.

How to ZIP a File in Windows

It is quite simple to zip files and folders in Windows OS, as mentioned below:

  1. Locate the file(s)/folder(s) that need to be zipped.
  2. Select the files using Ctrl+click.
  3. Right click the selected files and go to the Send to menu.
  4. Select the Compressed (zipped) folder option from the list.
  5. Name the zipped folder as you want.

Zipping Files in Mac OS

Similar to Windows, Mac OS also provides you with a 2-step solution to create a ZIP file.

  1. Select the files/folder you want to zip.
  2. Use Control+click and select the Compress option from the menu.
  3. Rename the ZIP folder.

How to ZIP Files - Developer’s Guide

If you want to zip a file programmatically, you can do it easily using our standalone library for .NET. So let’s have a look at how you can zip files using the C# code.

// Create FileStream for output ZIP archive
using (FileStream zipFile = File.Open("compressed_file.zip", FileMode.Create))
{
    // File to be added to archive
    using (FileStream source1 = File.Open("alice29.txt", FileMode.Open, FileAccess.Read))
    {
        using (var archive = new Archive(new ArchiveEntrySettings()))
        {
            // Add file to the archive
            archive.CreateEntry("alice29.txt", source1);
            
            // Create ZIP file
            archive.Save(zipFile);
        }
    }
}

Visit this page to read a complete tutorial on zipping files and folders.

Summing Up

In this article, you have learned how to create ZIP files online, manually, or programmatically. We have shared with you a powerful online zipping tool that you can use at any time anywhere, and zip as many files as you want. Also, you have seen how to zip files in Windows and Mac. Finally, we have provided a brief overview for developers to create ZIP files programmatically.

See Also