Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Copy the Folder Structure of a FolderContent of Copy the Folder Structure of a Folder.vbsMD5 Hash: C13054B672B986B83455250E5684177B |
||
On Error Resume Next
Dim arrFolders() intSize = 0 strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") strFolderName = "c:\scripts" GetSubFolders strFolderName Sub GetSubFolders(strFolderName) Set colSubfolders = objWMIService.ExecQuery _ ("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _ & "Where AssocClass = Win32_Subdirectory " _ & "ResultRole = PartComponent") For Each objFolder in colSubfolders strFolderName = objFolder.Name ReDim Preserve arrFolders(intSize) arrFolders(intSize) = strFolderName intSize = intSize + 1 GetSubFolders strFolderName Next End Sub Set objFSO = CreateObject("Scripting.FileSystemObject") For Each strFolder in arrFolders strFolderName = strFolder strNewFolder = Replace(strFolderName, "c:\scripts", "c:\test") Set objFolder = objFSO.CreateFolder(strNewFolder) Next | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |