Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Zipping in VFP
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01125311
Message ID:
01151200
Vues:
39
This seems to work if there is an empty directory.
procedure Archive
lparameters tcZipFile, tcSourceDir
if empty(m.tcZipFile)
	tcZipFile = inputbox("Enter zip file", ;
		"Enter zip file with the path", "temp.zip")
	if empty(m.tcZipFile)	
		return "Zip file must be specified."
	endif	
endif	
if empty(m.tcSourceDir)	
	tcSourceDir = getdir('','Select directory','Select directory to archive files')
	if empty(m.tcSourceDir)
		return "Source directory must be specified."
	endif	
endif	
tcSourceDir = addbs(m.tcSourceDir)

local loShell, loFile, lcError
lcError = ""
try
	strtofile(chr(0x50) + chr(0x4B) + chr(0x05) + chr(0x06) + replicate(chr(0),18), m.tcZipFile)
	loShell = createobject("shell.application")
	for each loFile in loShell.NameSpace(m.tcSourceDir).items
		if upper(m.loFile.Path) <> upper(m.tcZipFile)
			if not m.loFile.IsFolder or (m.loFile.IsFolder and m.loFile.GetFolder().Items.Count > 0)
				loShell.NameSpace(m.tcZipFile).CopyHere(m.loFile)
			endif
		endif	
	endfor
catch to loErr
	lcError = Log_Error(m.loErr)
endtry
return m.lcError
endproc
For a single file I may try filter method...

>The oFile is an object. You can analyze its properties, oFIle.IsFolder, oFile.Name, oFile.Path, e.t.c.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform