Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Zipping files from inside VFP
Message
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:
01222566
Vues:
26
>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?
>

What is your operating system?

I use
loZip = CreateObject("XStandard.Zip")
   FOR lnI = 1 TO ALEN(laFiles)
      loZip.Pack(laFiles[m.lnI], m.lcBackUpDir + m.lcZipFile, .t.)
   next
You can create a list of files starting with A_ using
ADIR(laFiles,myPath + "A_*.*")

xzip.dll was recommended by Frank Cazabon. See Re: Today's work - all gone :( Thread #1199789 Message #1200096 I like it so far, though there are lots of other alternatives to do zipping in VFP.

In this thread you can see discussion for all alternatives
Zipping in VFP Thread #1125311
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform