Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WSH Compress Folder
Message
De
25/08/2005 12:04:29
 
 
À
25/08/2005 08:24:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01043792
Message ID:
01043940
Vues:
13
>Hi All. What is the WSH command to compress a folder?

This may not use the WSH classes, but it does do the job.
* Program:     WMI_FOLDER.PRG
* Description: Compress and Uncompress folders
* Created:     08/25/2005
* Developer:   Gregory L Reichert
* Resource:    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_directory.asp
*------------------------------------------------------------

SET STEP ON 
IF NOT DIRECTORY("c:\temp")
	MD c:\Temp
	STRTOFILE("Hello World", "c:\temp\Test.txt")
endif

clear

LOCAL lcComputer, lcolFolder, loObj, loWMIService 

lcComputer = "."
loWMIService = GetObject("winmgmts:" +"{impersonationLevel=impersonate}!\\"+lcComputer+ "\root\cimv2")
lcolFolder = loWMIService.ExecQuery ("Select * from Win32_Directory where Caption='c:\\Temp'")
For Each loFolder in lcolFolder
	?
  	? "AccessMask=",loFolder.AccessMask
  	? "Archive=",loFolder.Archive
  	? "Caption=",loFolder.Caption
  	? "Compressed=",loFolder.Compressed
  	? "CompressionMethod=",loFolder.CompressionMethod
  	? "CreationClassName=",loFolder.CreationClassName
  	? "CreationDate=",loFolder.CreationDate
  	? "CSCreationClassName=",loFolder.CSCreationClassName
  	? "CSName=",loFolder.CSName
  	? "Description=",loFolder.Description
  	? "Drive=",loFolder.Drive
  	? "EightDotThreeFileName=",loFolder.EightDotThreeFileName
  	? "Encrypted=",loFolder.Encrypted
  	? "EncryptionMethod=",loFolder.EncryptionMethod
  	? "Extension=",loFolder.Extension
  	? "FileName=",loFolder.FileName
  	? "FileSize=",loFolder.FileSize
  	? "FileType=",loFolder.FileType
  	? "FSCreationClassName=",loFolder.FSCreationClassName
  	? "FSName=",loFolder.FSName
  	? "Hidden=",loFolder.Hidden
  	? "InstallDate=",loFolder.InstallDate
  	? "InUseCount=",loFolder.InUseCount
  	? "LastAccessed=",loFolder.LastAccessed
  	? "LastModified=",loFolder.LastModified
  	? "Name=",loFolder.Name
  	? "Path=",loFolder.Path
  	? "Readable=",loFolder.Readable
  	? "Status=",loFolder.Status
  	? "System=",loFolder.System
  	? "Writeable=",loFolder.Writeable
	
	? loFolder.Compress()			&& 0 if successful.
	? loFolder.Uncompress() 			&& 0 if successful.
	EXIT 	
	
NEXT

RETURN 
P.S. It does take a little time for it to locate the folder at the FOR EACH statement.
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform