[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-345930-105":59,"doc-detail-345930-en":131},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":124,"head_meta":126,"extra_data":128,"updated_unix":130},105,"en","zipfile-and-unzipfile-compress-and-uncompress-files-and-directories-in-zip-archive-format","zipfile and unzipfile - Compress and uncompress files and directories in zip archive format","","zipfile and unzipfile provide command-based workflows for creating, updating, and extracting Zip archives. zipfile compresses files and directories into Zip64-compatible archives and supports compatibility with Zip-based formats from common tools. unzipfile extracts archive contents into the current directory, optionally replacing existing entries. Detailed syntax options cover saving targets, compression level control, include/exclude pattern filters using Java regex, and stored results reporting counts and size metrics for both operations.",{"@graph":69,"@context":123},[70,84,106],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/zipfile-and-unzipfile-compress-and-uncompress-files-and-directories-in-zip-archive-format/345930/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/zipfile-and-unzipfile-compress-and-uncompress-files-and-directories-in-zip-archive-format/345930.png","ImageObject",300,407,{"name":92,"@type":93},"Rhys","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-25","2026-09-22",true,{"@type":102,"interactionType":103,"userInteractionCount":105},"InteractionCounter",{"@type":104},"ViewAction",14,{"@type":107,"mainEntity":108},"FAQPage",[109,115,119],{"name":110,"@type":111,"acceptedAnswer":112},"What do zipfile and unzipfile do?","Question",{"text":113,"@type":114},"zipfile compresses files and directories into a zip archive. unzipfile extracts files and directories from a zip archive into the current directory.","Answer",{"name":116,"@type":111,"acceptedAnswer":117},"How can I save a zip with zipfile and replace an existing one?",{"text":118,"@type":114},"Use saving(zipfilename) with zipfile. Add replace inside saving(...) to overwrite the target archive if it already exists.",{"name":120,"@type":111,"acceptedAnswer":121},"Can I extract only selected files from a zip?",{"text":122,"@type":114},"Yes. Use ifilter(includefilter) to include only paths matching a Java regex pattern, or efilter(excludefilter) to exclude paths matching a pattern.","https://schema.org",{"og:url":83,"og:type":125,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":127,"canonical":83},"index,follow",{"doc_id":129,"site_id":62},345930,1790376358,{"code":4,"msg":5,"data":132},{"doc_id":129,"user_id":133,"nickname":92,"user_avatar":134,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":135,"file_id":136,"file_url":137,"file_type":138,"file_size":139,"view_count":105,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":81,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":144,"read_time":39,"preview_page_count":81,"preview_urls":145},687207024643,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","zipfile—Compress and uncompress files and directories in zip archive format  \nDescription  \nOptions for unzipfile  \nQuick start  \nRemarks and examples  \nSyntax  \nStored results  \nOptions for zipfile  \nDescription  \nzipfile 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.  \nunzipfile 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.  \nQuick start  \nCompress mydata.dta and save [as](as myproject.zip)[ myproject.zip](as myproject.zip)  \nzipfile mydata.dta, saving(myproject)  \nSame as above, but also compress mydofile.do and mylog .smcl  \nzipfile mydata.dta mydofile.do mylog.smcl, saving(myproject) Replace myproject .zip if it already exists  \nzipfile mydata.dta mydofile.do mylog.smcl, ///  \nsaving(myproject, replace)  \nCompress all files in the myproject subdirectory of the current directory  \nzipfile myproject/*, saving(myproject)  \nExtract files and directories from myzip.zip to the current directory  \nunzipfile myzip  \nSame as above, but replace any file or directory in the current directory that has the same name as a file or directory in the zip file  \nunzipfile myzip, replace  \nSyntax  \nAdd files or directories toa zip file  \nzipfile file | directory [file | directory ] ..., saving(zipfilename[ , replace ])[  complevel(\\#) ]  \nExtract files or directories from a zip file unzipfile zipfilename [ , replace  \nifilter(includefilter) efilter(excludefilter) ]  \nNote: 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.  \nOptions for zipfile  \nsaving(zipfilename[ , replace ]) specifies the filename to be created or replaced. If zipfilename is specified without an extension, .zip will be assumed. saving() is required.  \ncomplevel(\\#) sets the compression level for the zipfile. \\# is an integer from 0, meaning no compression, to 9, meaning full compression. The default is complevel(6) .  \nOptions for unzipfile  \nreplace overwrites any file or directory in the current directory with the files or directories in the zip file that have the same name.  \nifilter(includefilter) limits the extracted files by including only those files that match the specified pattern. Pattern matching is based on java.util .regex.Pattern.  \nefilter(excludefilter) limits the extracted files by excluding all files that match the specified pattern. Pattern matching is based on java.util .regex.Pattern.  \nRemarks and examples  \n Example 1: Creating a zip file  \nSuppose that we would like to zip all the .dta files in the current directory into the file myfiles .zip. We would type  \n. zipfile *.dta, saving(myfiles)  \nBut we notice that we did not want the files in the current directory; instead, we wanted the files in the dta, abc, and eps subdirectories. We can easily zip all the .dta files from all three-character subdirectories of the current directory and overwrite the file myfiles.zip if it exists by typing  \n. zipfile ???/*.dta, saving(myfiles, replace)  \nExample 2: Unzipping a zip file  \nSay, for example, we send myfiles .zip to a colleague, who now wants to unzip the file in the current directory, overwriting any files or directories that have the same name as the files or directories in the zip file. The colleague should type  \n. unzipfile myfiles, replace  \nStored results  \nzipfile stores the following in r():  \nScalars  \nr(archived) number of files compressed  \nr(skipped) number of files skipped  \nr(total) number of files processed  \nr(compressed size) size of compressed file  \nr(processed size) combined size of all processed files  \nr(compression ratio) ratio of compressed size to uncompressed size unzipfile stores the following in r():  \nScalars  \nr(extracted) number of fi","cbCaimMdOd45eNTS","https://ap.wps.com/l/cbCaimMdOd45eNTS","pdf",89275,"English","# Quick start\n## Remarks and examples\n### Creating a zip file\n### Unzipping a zip file\n# Syntax\n## Options for zipfile\n## Options for unzipfile\n## Stored results","[{\"question\":\"What do zipfile and unzipfile do?\",\"answer\":\"zipfile compresses files and directories into a zip archive. unzipfile extracts files and directories from a zip archive into the current directory.\"},{\"question\":\"How can I save a zip with zipfile and replace an existing one?\",\"answer\":\"Use saving(zipfilename) with zipfile. Add replace inside saving(...) to overwrite the target archive if it already exists.\"},{\"question\":\"Can I extract only selected files from a zip?\",\"answer\":\"Yes. Use ifilter(includefilter) to include only paths matching a Java regex pattern, or efilter(excludefilter) to exclude paths matching a pattern.\"}]","zipfile and unzipfile - Compress and uncompress files and directories in zip archive format | PDF",1790059425,[146,150,154],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/882452f5796195764545886ca181237a.webp",983,1403,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/dddfecb4c08f21a04cf5595d9f1d62ac.webp",982,1402,{"page_no":81,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-16/1355c992a387fe477481c49424ee8d32.webp",981,1400]