Skip to content

kawagita/p7zip-zhrebel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zip header rebel

This program is to change file headers in zip archive by p7zip command. If you make zhrebel on a root directory of source package, bin/7za-zhrebel is created. Its executable could set and change character encodings or timestamps to the local file and central directory header by uh command with new switches.

Install

Execute build_install.sh in the project root. And then 7za-rebel is installed to /usr/local/bin by default.

  ./build_install.sh <target_system> [ <install_directory> ]

Otherwise, you can manually build it by overwriting makefile.machine to makefile.XXXXX (target system), and copy to any directory.

Command

uh (Update Header) command

Updates file headers in archive.

Syntax

  7za-zhrebel uh <archive_name> [ <filename> ... ]

By uh command, file data are not compressed but copied, and only header informations are updated. Headers which filename is specified at the tail of an archive name on command line are replaced in the same archive. However, '*' (in quotes) or no filename is put on the last, all directories or files are targeted.

Never change the modification time of encrypted data by Info-ZIP or remove its data descriptor. If done, original file can not be extracted from an archive. This command asks to change such header, so that you must select to continue or not.

Notes

This command can't be used with -u switch.

Switches

-uh (Update header for only directory/file) switch

Updates header information for only directories or files.

Syntax

  -uh{d|f}
{id} Item Type
d Directory
f File

Commands that can be used with this switch

uh (Update Header)

-h (Set Header information) switch

Specifies the header information.

Syntax

  -h<header_parameters>

Notes: "Default value" in switches descriptions means the value that will be used if switch is not specified.
It's allowed to use reduced forms for boolean switches: sw+ or sw instead sw=on, and sw- instead of sw=off.

Parameter Default Description
init=[off | on] off1 Initializes file information for setting by p7zip.
lc={Locale} UTF-8 Encodes and decodes filename or comment for Locale.
en={Locale} UTF-8 Encodes filename or comment for locale.
de={Locale} UTF-8 Decodes filename or comment for locale.
dc={Locale} UTF-8 Decodes only Comment for locale.
t=[WIN | UNIX | DOS | 0] (WIN1) Stores Time field of a format type to headers.
tm={Timestamp} 2 Sets Modification time to timestamp.
ta={Timestamp} 2 Sets Last accessed time to timestamp.
tc={Timestamp} 2 Sets Creation time to timestamp.
tfm=[off | on] off Sets all times from Modification time.
tz=[[+|-]hh:mm] 00:00 Adjusts all times with a Time Zone.
tzm=[[+|-]hh:mm] 00:00 Adjusts Modification time with a Time Zone.
tza=[[+|-]hh:mm] 00:00 Adjusts Last accessed time with a Time Zone.
tzc=[[+|-]hh:mm] 00:00 Adjusts Creation time with a Time Zone.
f=[WIN | UNIX | BOTH] (BOTH1) Sets host system on which file information is compatible.
iz=[off | on] off Sets file information with ownership field like Info-Zip.
attrib=[[+|-][R | A | S | H | I]]... 2 Sets or clears file Attribute of Windows.
mod={OctalMode} 2 Sets file permissions to octal number of Unix Mode bits.
uid={NumUID} 2 Sets file ownership to number of Unix UID.
gid={NumGID} 2 Sets file ownership to number of Unix GID.
own=[off | on] off Stores file Ownership field to headers.
dd=[off | on] off Stores data descriptor which follows compressed data.
ex=[off | on] off Leaves all Extra fields in headers.
exa={HeaderID(s)} 3 Leaves Extra field of header ID(s) in headers.
exd={HeaderID(s)} 3 Removes Extra field of header ID(s) from headers.

^1: Only when added, Windows attribute and file permissions is set as Unix compatibility and NTFS time is stored.
^2: Informations are read from files on disk if exists or headers in archive.
^3: Values of exa or exd parameter is effective in the state of ex=off or ex=on.

lc={Locale}
en={Locale}
de={Locale}

Sets the locale for filename and comment read from and/or written to file headers. The codeset must be specified though no language code is completed by system locale.

t=[WIN | UNIX | DOS | 0]

Sets the time format of file headers. NTFS or Unix time is stored in an extra field if WIN or UNIX. Otherwise, only DOS time format. Especially, that's cleared if 0 is specified.

tm={Timestamp}
ta={Timestamp}
tc={Timestamp}

Sets the modification, last accessed, or creation time of file headers to a timestamp. This value is YYYYMMDDhhmm[.ss] or YYYY-MM-DDThh:mm:ss[.nnnnnnn] but its seconds or nanoseconds is counted up or ignored for the time format. Moreover some time can't be stored, see below.

Format Resolution Present time fields
NTFS Time 100 nsec all times of a file
Unix Time 1 second modification and last accessed time
DOS Time 2 seconds only modification time

f=[WIN | UNIX | BOTH]

Sets the host system on which file information is compatible. Windows attribute or file permissions is set only as FAT or Unix file if WIN or UNIX. Otherwise, both information is set as Unix compatibility.

attrib=[[+|-][R | A | S | H | I]]...

Sets or clears file attribute for R (ReadOnly), A (Archive), S (System), H (Hidden), and I (Not Content Indexed) preceded by + or -.

exa={HeaderID(s)}
exd={HeaderID(s)}

Sets the list of extra fields which are left or removed by uh command in the state of ex=off or ex=on. These values are hexadecimal preceded by 0x or decimal number of header ID (which is printed by l command with -slt switch) and following ones are separated by a comma. This parameter only changes headers so that can't control ZIP64 and encryption fields. Besides the above parameters set NTFS or Unix time fields.

Commands that can be used with this switch

a (Add), rn (Rename), u (Update), uh (Update Header)

and, only lc, de, and dc parameters:

e (Extract), l (List), T (Test), x (Extract with full paths)

License

This program is published under LGPL v2.1.

See p7zip_16.02/DOC/License.txt about the original p7zip license.

Footnotes

  1. #note1 2 3

  2. #note2 2 3 4 5 6 7

  3. #note3 2

About

Changes file headers in zip archive by p7zip command

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published