Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: incorporating zipped files into do-files


From   "Sergiy Radyakin" <[email protected]>
To   [email protected]
Subject   Re: st: incorporating zipped files into do-files
Date   Mon, 28 Jul 2008 19:43:15 -0400

Dear Murali,

see this thread earlier in the Statalist or search it in Google:

"st: Undocumented zip/unzip capabilities of Stata 10"

Although it is undocumented, it works fine so far and I believe it is
going to stay with us because of:

" 22.  Official ado updates may now be distributed as a compressed archive.
         This can make updates significantly faster for those with a slow
         internet connection."

http://www.stata.com/help.cgi?whatsnew
Stata executable, all platforms

But Stata developers might, of course, decide otherwise in the future.

Note that it is very easy to extract several files at once with this command:

//-------------------------------------
unzipall.ado------------------------------------------------
// Sergiy Radyakin, 2007-2008
// This is a wrapper to an undocumented unzipfile command in Stata 10
// It may or may not work in the later versions.
// It does not work in any version prior to 10.
// Use at your own risk, e.g.:

// unszipall, from("c:\temp\myarchive.zip") to("c:\unpacked")
//            overwrite password("mypassword")


program unzipall
 version 10.0
 syntax ,from(string) [to(string) overwrite password(string)]

 local  startdir `"`c(pwd)'"'
 if missing(`"`to'"') local `"`to'"' `"`startdir'"'
 quietly cd `"`to'"'
 unzipfile `"`from'"', `overwrite' password(`"`password'"')
 quietly cd `"`startdir'"'
end

// -------------------------------- end of unzipall.ado
--------------------------------------------



The benefit of using this code is of course that you don't have to
install anything in addition to the .ado file, such as the unzip
utility that Dr. Stovring mentions in the help file for -zipuse-.


Best regards,
    Sergiy Radyakin






On 7/25/08, Svend Juul <[email protected]> wrote:
> Murali wrote:
>
>      My question concerns the use of data files which are compressed into a
> zip-folder.Is there a way to incorporate the un-zipping of these files in the
> form of code that is part of a do-file as opposed to individually extracting
> each and every needed file separately from the do-program? Thanks.
>
> ==================================================================
>
> You might benefit from Henrik Stovring's -zipsave- and -zipuse- commands.
> Find and install them by:
>
>   . findit zipsave
>
> HTH
> Svend
>
> ________________________________________________________
>
> Svend Juul
> Institut for Folkesundhed, Afdeling for Epidemiologi
> (Institute of Public Health, Department of Epidemiology)
> Vennelyst Boulevard 6
> DK-8000 Aarhus C,  Denmark
> Phone, work:   +45 8942 6090
> Phone, home:   +45 8693 7796
> Fax:           +45 8613 1580
> E-mail:        [email protected]
> _________________________________________________________
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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