[Python] Recursively Extracting Nested Archive Files

Discussão em 'Python' iniciado por Stack, Março 4, 2025.

  1. Stack

    Stack Membro Participativo

    I have 500+ archive files that contain other archive files (.zip, .rar, .7z). For example:

    archive.zip
    |
    |-file.abc
    |
    |-nested_archive.7z
    |
    file.def
    |
    nested_nested_archive.rar
    |
    file.ghi


    How can I unarchive each nested archive to a folder in the same place (with the original nested archive file being deleted)? For example:

    archive.zip
    |
    |-file.abc
    |
    |-nested_archive_dir/
    |
    file.def
    |
    nested_nested_archive_dir/
    |
    file.ghi


    I've used py7zr, zipfile, and rarfile in Python, but a lot of these archive files aren't supported (BJC2 format). Is there a way to do this (ideally from the command line) in Windows?

    Continue reading...

Compartilhe esta Página