Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Use Archive Utility on macOS

Archive Utility is a built-in tool on macOS that allows users to compress and decompress files and folders. This utility is essential for managing file sizes, organizing data, and sharing files efficiently. Unlike third-party applications, Archive Utility is seamlessly integrated into the macOS environment, making it a convenient option for users. This article will guide you through the process of using Archive Utility, including how to access it via the graphical user interface (GUI) and the command line.

Examples:

Using Archive Utility via GUI

  1. Compressing Files and Folders:

    • Select the files or folders you want to compress.
    • Right-click (or Control-click) on the selected items.
    • Choose "Compress" from the context menu.
    • A new compressed file with a .zip extension will appear in the same directory.
  2. Decompressing Files:

    • Double-click the compressed file (e.g., .zip).
    • The contents will be extracted to the same directory as the compressed file.

Using Archive Utility via Command Line

While Archive Utility itself does not have a direct command-line interface, macOS provides the zip and unzip commands that offer similar functionality.

  1. Compressing Files and Folders:

    zip -r archive_name.zip /path/to/folder_or_file
    • -r option is used to recursively compress directories.
    • Example:
      zip -r my_archive.zip /Users/username/Documents/my_folder
  2. Decompressing Files:

    unzip archive_name.zip -d /path/to/destination_folder
    • -d option specifies the directory where the contents should be extracted.
    • Example:
      unzip my_archive.zip -d /Users/username/Documents/extracted_files

Automating with AppleScript

For users who prefer automation, AppleScript can be used to compress and decompress files.

  1. Compressing Files:

    set theFolder to choose folder
    set theZipFile to (theFolder as text) & ".zip"
    do shell script "zip -r " & quoted form of POSIX path of theZipFile & " " & quoted form of POSIX path of theFolder
  2. Decompressing Files:

    set theZipFile to choose file
    set theDestination to choose folder
    do shell script "unzip " & quoted form of POSIX path of theZipFile & " -d " & quoted form of POSIX path of theDestination

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.