I need to find out is the path to the folder includes hidden folders or not. Does anybody know how to do it? I have to use associators. Now my script only shows is the exact folder hidden or not and not checking the path to it.
Dim xdoc
Function CreateFolders(objFile)
Dim elem
Dim attr
Set elem = xdoc.CreateElement("Folder")
Set attr = xdoc.CreateAttribute("Description")
attr.Value = objFile.Description
elem.SetAttributeNode attr
Set CreateFolders = elem
End Function
Dim FilePath
Dim objFile
Dim root
Dim elem, elem1
Dim FilePath2
Set oFSO = CreateObject("Scripting.FileSystemObject")
If WScript.Arguments.Count > 0 Then
sFile = WScript.Arguments(0)
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.GetFile(sFile)
sModify = oFile.DateLastModified
End If
End If
FilePath2 = WScript.Arguments(0)
Set xdoc = CreateObject("MSXML2.DOMDocument.6.0")
xdoc.AppendChild xdoc.CreateProcessingInstruction("xml", "version=""1.0"" encoding=""utf-8""")
FilePath = "C:\Users\User\Downloads\My123.xml"
Set root = xdoc.CreateElement("Folders")
xdoc.AppendChild root
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("SELECT * FROM Win32_Directory WHERE Name = '" & FilePath2 & "'")
For Each objFile In colFiles
Wscript.Echo objFile.Name & " " & "Status: " & objFile.Hidden
Set elem = CreateFolders(objFile)
root.AppendChild elem
Next
xdoc.Save FilePath