Skip to main content

Compress-Files-or-Folders

Command Description

Compress the file or folder into .Zip file. File with the same name will be directly covered

Command Prototype

sRet = File.Compress(sPath,sZipPath,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
sPathTruepath'''C:\Users'''The File or Folder path to which you need to be compressed supports the input string and Array Type. Enter a string represents a single file or folder. The input array represents a collection of File Path (such as multiple files under the same parent path)
sZipPathTruepath'''C:\Users'''Compressed zip file path, for example @res"abc.zip"
sPasswordNonestring""Set compressed file password
sAlgorithmNoneenum"standard"Select the level of compression algorithm

return

sRet,The variable used to save the output of the command.

Demo

/************************************Compressed file or folder*********** ********************* 
Command prototype:
sRet = File.Compress('''C:\Users''','''C:\Users''',{"sPassword":'',"sAlgorithm":"standard"})
Input parameters:
sPath--file or folder path to be compressed
sZipPath--compressed zip file path
sPassword--set the compressed file password (optional)
sAlgorithm--select the level of the compression algorithm (optional)
Outgoing parameters:
sRet--the result after the command is run
********************************************************************************/
Dim sPath='''C:\Users\Chance\Desktop\testFile\tempFolder'''
Dim sZipPath='''C:\Users\Chance\Desktop\all.zip'''
sRet = File.Compress (sPath, sZipPath, {"sPassword": '', "sAlgorithm": "standard"})
TracePrint (sRet)