call main()
Sub main()
Dim fs' file system.
Dim f 'folder
Dim fc 'files
Dim s 'string
Dim ws 'SHELL。
Dim subfs
Dim fi
'Create SHELL.
Set ws = CreateObject("")
'Create a file object.
Set fs = CreateObject("")
Set f = ()
Handle_files()
Set subfs =
'Travel over each subdirectory.
For Each fi In subfs
Call ListSub()
Next
End Sub
Sub ListSub(filename)
On Error Resume Next
Dim subfs' subdirectory.
'First process the current directory.
Handle_Files(filename)
'Create a file object.
Set fs = CreateObject("")
Set f = (filename)
Set subfs =
For Each fi In subfs
Call ListSub()
Next
End Sub
'Processing files under each directory.
Sub Handle_Files(foldername)
'Create a file object.
Set fs = CreateObject("")
Set f = (foldername)
Set fc =
'Create SHELL.
Set ws = CreateObject("")
'Travel over the file object.
For Each fl In fc
if ( RegExpTest(".vbs|.rar|.zip",) = false) then
'Compress.
s = "winrar M -ep " & & ".rar " &
output s
s, 0, True
End If
Next
End Sub
sub output(string)
string
end sub
'Use regular expressions to judge.
Function RegExpTest(patrn, strng)
Dim regEx, retVal ' Create variable.
Set regEx = New RegExp ' Create regular expression.
= patrn ' Set pattern.
= False ' Set case sensitivity.
retVal = (strng) ' Execute the search test.
If retVal Then
RegExpTest = true
Else
RegExpTest = false
End If
End Function