Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Multiple conditions needed in VB Scrip

$
0
0

Hi there,

I am new to VB Scripting and am trying to add an additional excluded folder to a script someone else wrote.  I would have thought that would be very simple but I have tried every combo of If, Then Else statements I can think of and it still won't work.  So I have come in desperation to this forum.

This script checks folders for older files and empty subfolders which can be deleted.  It skips one folder (!publish) but I need it to exclude at least one more.  This is done in a subroutine called folders and here is the first part.....


'--------------------------------------------
' Get the Folders that match the rules
'--------------------------------------------
Sub Folders
strPath = "\\" & strTarget & "\\"
'Wscript.Echo "Path: " & strPath

Set colTargetFolders = objSWbemServices.ExecQuery("Select * from Win32_Directory where Drive = '" & strDrive & "' and Path = '" & strPath & "'")
If colTargetFolders.Count > 0 then
 For Each objTFolder in colTargetFolders


 If INSTR(Right(objTFolder.Name,(Len(objTFolder.Name)-2)), "!publish") = 0 Then
  If a = 0 Then

   ReDim strRules(a)
   strRules(a) = Right(objTFolder.Name,(Len(objTFolder.Name)-2))
   a = 1

Thanks!


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>