Project

General

Profile

Up

_7zExtract

Extract an 7zip archive (format 7z). If a file already exists, a backup (*.bak) will be done automatically.

If you want, you can define a callback for each extracted item. In this case, see _7zCallback. This optional callback must be defined before to use _7zExtract.

Prototype :

fun [P DW I I I] I

  • P : a read file reference of the archive
  • DW : a write-directory reference where items will be extracted
  • I : overwrite (1) the item if it already exists or keep it (0). 0 by default
  • I : perform (1) a backup if the item already exists or not (0). 1 by default
  • I : overwrite (1) the backup if it already exists or keep it (0). 1 by default

Return : I 0 if success.

See also

Example

Create a new directory and extract an archive in this. The callback is optional.

fun cb7z (blurb, user_parameter, archive, name, isdir, size, state)=
	_fooS sprintf "u : %s archive : %s name : %s size : %d isdir : %d state : %d\n" [user_parameter archive name size isdir state];
	0;;

fun main ()=
	_showconsole;
	...
	_createDirectory _getModifyDirectory "examples" "7z";
	_7zCallback @cb7z "CB";
	_fooId _7zExtract _checkpack "examples/packages.7z" _getModifyDirectory "examples/7z" 1 1 1;
	...