Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Zipping files from inside VFP
Message
De
04/05/2007 13:49:43
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01222560
Message ID:
01222563
Vues:
54
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform