Friends,

Some months ago there was a posting of code for UNZipping in Window XP (code
is appended below), it is working fine, however it creates an EXTRA folder
under:

C:\Documents and Settings\USER\Local Settings\Temp\

by the name of Temporary Directory 1 for UNZIPPEDFILE.zip

Temporary Directory 2 is also created if the same file is unzipped again.
After repeat runs on the same file, we may start getting curious results and
messages. It we unzip big files, then the Hard Disk can get filled up without
our knowledge.

It there some solution so that this folder is either not created or deleted
automatically after unzipping. I will look forward to have your comments.


Best Regards

S Bans

*****************

PROCEDURE UnZIP(lcZipFile AS STRING, lcToFolder AS STRING)
*
LOCAL lcEmptyZip AS STRING
LOCAL oSHELL AS SHELL.APPLICATION
lcEmptyZip = "PK"+CHR(5)+CHR(6)+REPLICATE(CHR(0),18)
TRY
oSHELL = CREATEOBJECT("Shell.Application")
IF NOT EMPTY(lcZipFile)
lcFullName = FULLPATH("&lcZipFile.")
IF UPPER(JUSTEXT(lcFullName)) <> "ZIP"
lcFullName = lcFullName + ".ZIP"
lcFullName = STRTRAN(lcFullName,"..",".")
ENDIF
IF NOT FILE("&lcFullName.")
= MESSAGEBOX("Zip File "+lcFullName+" not found",16,"Error")
EXIT
ENDIF
ELSE
= MESSAGEBOX("No Zip file name specified",16, "Missing info")
EXIT
ENDIF

IF NOT EMPTY(lcToFolder)
lcToFolder = FULLPATH("&lcToFolder")
TRY
loFolder = oSHELL.NameSpace("&lcToFolder.")
IF ISNULL(loFolder) && does not exist (create)
MKDIR "&lcToFolder."
loFolder = oSHELL.NameSpace("&lcToFolder.")
ENDIF
loZipFolder = oSHELL.NameSpace("&lcFullName.")

IF NOT ISNULL(loZipFolder)
lnZipFileCount = loZipFolder.ITEMS.COUNT
lnFileCount = loFolder.ITEMS.COUNT

loFolder.CopyHere(loZipFolder.ITEMS) && unzip executes
asynchronously

ENDIF

CATCH
ENDTRY
ELSE
= MESSAGEBOX("No files to ZIP",16, "Missing Info")
ENDIF
CATCH
FINALLY
ENDTRY

ENDPROC