익명 08:20

Does 7-Zip support editing archived file metadata without recompression?

Does 7-Zip support editing archived file metadata without recompression?

I've got a few hundred 7-Zip (executable '7z') archives that were recompressed with a very high compression level, and it took a very long time to process them all. While inspecting the original archives, I found that many of the nonexecutable files had the executable permission bit set, and these permissions were preserved in the recompressed archives.

As far as I know, 7z rn is the only command that modifies file metadata inside an existing archive, but it only affects filenames, which is effectively renaming files right in the archive. Is there a way to modify other archived file metadata, such as permission bits or timestamps, without recreating the archive (i.e., without using 7z a or 7z u)?



Top Answer/Comment:

This is a duplicate of a question on Stack Overflow, but no answer has been posted to that for 8 years. Likely, that is because there is no command line switch or other way to modify file attributes inside the archive.

That said, there are work-arounds during and after extraction.

  • Run chmod on files from a list. This should be feasible, since you know which files need to have attributes changed, and could run unattended.

    If desired, the extracted files could then be archived again.

  • if your desire is to prevent easy execution of all files in the archive, extract them into a nonexec location.

상단 광고의 [X] 버튼을 누르면 내용이 보입니다