Archiving Files

Learn how to add an archiving feature to the walk tool.

Before deleting files that are consuming too much space, we might want to back them up in a compressed form so we can keep them around in case we need them later. Let’s add an archiving feature to the walk tool to enable this feature.

Importing the compress/gzip package

To add this new feature, we’ll use these standard library packages:

  • compress/gzip to compress data using the gzip format.
  • io, which provides functions to help with Input/Output operations such as copying data.

The package io is already included in the import list. We add the compress/gzip package to the import list in the file ...