Stata 15 help for zipfile

[D] zipfile -- Compress and uncompress files and directories in zip archive format

Syntax

Add files or directories to a zip file

zipfile file|directory [file|directory] ... , saving(zipfilename[, replace])

Extract files or directories from a zip file

unzipfile zipfilename [, replace]

Note: Double quotes must be used to enclose file and directory if the name or path contains blanks. file and directory may also contain the ? and * wildcard characters.

Description

zipfile compresses files and directories into a zip file that is compatible with Zip64, WinZip, PKZIP 2.04g, and other applications that use the zip archive format.

unzipfile extracts files and directories from a file in zip archive format into the current directory. unzipfile can open zip files created by Zip64, WinZip, PKZIP 2.04g, and other applications that use the zip archive format.

Option for zipfile

saving(zipfilename[, replace]) is required. It specifies the filename to be created or replaced. If zipfilename is specified without an extension, .zip will be assumed.

Option for unzipfile

replace overwrites any file or directory in the current directory with the files or directories in the zip file that have the same name.

Examples

Zip all .dta files in the current directory into the file myfiles.zip

. zipfile *.dta, saving(myfiles)

Zip all .dta files from any three-character subdirectories of the current directory, and overwrite the file myfiles.zip if it exists

. zipfile ???/*.dta, saving(myfiles, replace)

Unzip the file myfiles.zip into the current directory, overwriting any files or directories that have the same name as the files or directories in the zip file

. unzipfile myfiles, replace


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index