Hi all,
This stock standard MS script below returns the first level directory listing. However, it does not return it the way it is in the actual directory. It alters the case which I desperately want to preserve, as I use this basic engine to get subdirectories to recreate the folders elsewhere. E.g.
Source Directory: C:\Windows\Web
Script output: C:\windows\web
Does anyone know of a switch to stop it, or reason why it does not preserve the actual case of the original directory.
Geoff.
Code:-------------------------------------------------------------------------------------
Option Explicit
DIM strComputer,objWMIService,colSubfolders,objFolder
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSubfolders = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='c:\windows'} " _
& "WHERE AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")
For Each objFolder in colSubfolders
Wscript.Echo objFolder.Name
Next