This Vbs script will create directory names contained in an Excel spreadsheet called C:\NewFolders.xls on a server share.
The Excel file must have one directory name per line in Column A as in the example below:
Folder1
Folder2
Folder3
Note: Be sure to change \\ServerName\ShareName\ as needed.
Vbs Script:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
strPathExcel = "C:\NewFolders.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
intRow = 1
Do Until objExcel.Cells(intRow, 1).Value = ""
strCN = Trim(objSheet.Cells(intRow, 1).Value)
If objFSO.FolderExists("\\ServerName\ShareName\" & strCN) Then
Else
objFSO.CreateFolder("\\ServerName\ShareName\" & strCN)
End If
intRow = intRow + 1
Loop
objExcel.Quit
Wscript.Echo "Done"
Hey,
Excellent script, just another quick question for you, I need to create a dirtory structure and this seems like an excellent way to do it, however, how do I create sub folders?
Thanks!
Saboath