Menu

Remove password from archive

Help
tsubus
2020-04-27
2020-04-27
  • tsubus

    tsubus - 2020-04-27

    Hi,

    I want to create a script that takes password-protected archives (the password is known) and removes the password. What would be the best way to go about this? Is there a way to do it without extracting and re-compressing without password?

    Thank you in advance for any feedback.

     

    Last edit: tsubus 2020-04-27
  • Boris Brodski

    Boris Brodski - 2020-04-27

    Hi,

    I would say, that the recompression is the only way to go. Although it might be technically possible to reuse compressed data, there is no API as I would know of to implement it at this moment.

    For small archives it is easy to use in-memory extraction and compression. You can use ByteArrayStream for each archive item.

    For large archives the simple way to extract everything into "/tmp" and recompress it later on (saving and reusing all attributes)

    Avoiding writing all the files to the disk may also be possible. You will have to run extraction and compression in parallel synchronizing both threads (actually both group of threads). If 7-zip supports such kind of parallelism is a question. You can ask it in the 7-zip forum here on SF.net.

    Kind regards,
    Boris

     
  • Boris Brodski

    Boris Brodski - 2020-04-27

    Hi,

    I would say, that the recompression is the only way to go. Although it might be technically possible to reuse compressed data, there is no API as I would know of to implement it at this moment.

    For small archives it is easy to use in-memory extraction and compression. You can use ByteArrayStream for each archive item.

    For large archives the simple way to extract everything into "/tmp" and recompress it later on (saving and reusing all attributes)

    Avoiding writing all the files to the disk may also be possible. You will have to run extraction and compression in parallel synchronizing both threads (actually both group of threads). If 7-zip supports such kind of parallelism is a question. You can ask it in the 7-zip forum here on SF.net.

    Kind regards,
    Boris

     

Log in to post a comment.