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

vbscript delete folders except difine in exception

$
0
0

Dear,

need support for below script for deleting all folders except in exception.

Its deleting all


Dim Exception
Exception = Array("Test2")


Function Deletfdrs()
    Dim fso, f, f1, fc, i
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFolder("C:\Temp1\")
    Set fc = f.SubFolders
    
         ForEach f1in fc
                        
            For i = 0toUBound(Exception)
            
           If f1.name = Exception(i) Then f1.Delete = False
           
        Next
        
                       
   f1.Delete
    
        'If delete = True Then msgbox(f1.name)'f1.delete
    Next
EndFunction


Support@Mytechnet.me


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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