For a long time, I have used the Windows Shell for Unzipping files. Now, I want to use the Windows Shell to Zip files, and cannot seem to find a working example.
Can someone help me out?
TIA,
Steve
Steve
Hi All,
For a long time, I have used the Windows Shell for Unzipping files. Now, I want to use the Windows Shell to Zip files, and cannot seem to find a working example.
Can someone help me out?
TIA,
Steve
Rick
Got it, I just wasn't using the examples on the web correctly. Sorry to bother.
Steve
Hi All,
For a long time, I have used the Windows Shell for Unzipping files. Now, I want to use the Windows Shell to Zip files, and cannot seem to find a working example.
Can someone help me out?
TIA,
Steve
West Wind Technologies
Making waves on the Web
from Hood River
Sure, here is what I ended up with, building on what I found on the net. It basically creates a zipped file from a single file within a folder.
*************************************************************************************************
* Zip_File
* Creates a Compressed Zip file
*************************************************************************************************
LPARAMETERS tcSource, tcTarget
IF PARAMETERS() <> 2
=MESSAGEBOX("Zip_File: Incorrect Parameters.",0+16,"Error",10000)
RETURN .F.
ENDIFLOCAL lcPath, lcFile, lcTarget, llResult
lcPath = JUSTPATH(tcSource)
lcFile = JUSTFNAME(tcSource)
lcTarget = tcTarget
llResult = .T.IF !FILE(tcSource)
=MESSAGEBOX("Zip_File: Source File not found.",0+16,"Error",10000)
RETURN .F.
ENDIF* Must Create Zip File
STRTOFILE(CHR(0x50)+CHR(0x4B)+CHR(0x05)+CHR(0x06)+REPLICATE(CHR(0),18),lcTarget,0)
IF !FILE(lcTarget)
=MESSAGEBOX("Zip_File: Could not create Zip File.",0+16,"Error",10000)
RETURN .F.
ENDIFWAIT WINDOW lcFile + " - Compressing file, please wait..." NOWAIT NOCLEAR
oShell = CREATEOBJECT("shell.application")
IF TYPE('oShell') = 'O' AND !ISNULL(oShell)FOR EACH oFile IN oShell.NameSpace(lcPath).Items
IF oFile.Name = lcFile
oShell.NameSpace(lcTarget).CopyHere(oFile)
ENDIF
ENDFORELSE
llResult = .F.
=MESSAGEBOX("Zip_File: Could not load Compression Utility.",0+16,"Error",10000)ENDIF
oShell = NULL
WAIT CLEAR
RETURN llResult
HTH,
Steve
Would you mind sharing what you found? Or links?
Rick
Got it, I just wasn't using the examples on the web correctly. Sorry to bother.
Steve
Hi All,
For a long time, I have used the Windows Shell for Unzipping files. Now, I want to use the Windows Shell to Zip files, and cannot seem to find a working example.
Can someone help me out?
TIA,
Steve