>I have qa need to implement a zip function in my application
>This is the code I am using (not mine... don't remember where I got it from <bg>)
>
>LOCAL lcZipFileName,lcDataPath
>IF TYPE('oApp')='O'
> lcDataPath=oApp.DataLocn
>ELSE
> lcDataPath='DATA'
>ENDIF
>lcZipFileName=ADDBS(lcDataPath)+'AFIles'+SYS(2015)+"_"+TTOC(DATETIME(),1)+".ZIP"
>strtofile(chr(0x50)+chr(0x4B)+chr(0x05)+chr(0x06)+replicate(chr(0),18),lcZipFileName)
>oShell=CREATEOBJECT("shell.application")
>FOR EACH ofile IN oShell.NameSpace(lcDataPath).items
> oShell.NameSpace(cFileZip).copyhere(ofile)
>ENDFOR
>
>Code fails on NameSpace line
>Error is: Member Namespace does not evaluate to an object.
>
>Also, I only want to archive files that start 'A_'
>
>How do I modify the code above to only include files of the above type?
>
>TIA,
>Mike
Mike,
You have typo in code as I could see with this piece. Wouldn't it be "m.lcZipFileName" instead of "cFileZip"?
ie:
lcSource = "C:\Program Files\Microsoft Visual FoxPro 9\Samples\Northwind"
lcZipFileName="c:\temp\NortwindFiles.zip"
strtofile(chr(0x50)+chr(0x4B)+chr(0x05)+chr(0x06)+replicate(chr(0),18),m.lcZipFileName)
oShell=CREATEOBJECT("shell.application")
FOR EACH ofile IN oShell.NameSpace(m.lcSource).items
oShell.NameSpace(m.lcZipFileName).copyhere(ofile)
ENDFOR
Cetin