i had an assignment in which you had to create a program that generates 50 subfolders, though the program i made could do that, it couldnt generate over 100 folders. Im just curious. is the file extension too long? and how do i solve this? Script is below...
Dim strfolder, b, sub1 Dim strRoot2, root
strRoot="c:\Users\Admin\Desktop" Set objFSO=CreateObject("Scripting.FileSystemObject") Set objFolder=objFSO.GetFolder(strRoot) Set colFolders=objFolder.SubFolders
strFolder = InputBox("Please Enter a Folder Name.") b = InputBox("Please Enter How Many SubFolders")
If objFSO.FolderExists(strRoot & strFolder) Then WScript.Echo "Folder " & strRoot & strFolder &_ " already exists" Else End If
Do while b>0 colfolders.Add strFolder b = b-1 strRoot=strRoot&"\"&strfolder Set objFolder=objFSO.GetFolder(strRoot) Set colFolders=objFolder.SubFolders Loop
Wscript.Echo "Job Done"
I keep on getting the error line 20 char 5 file not found when entering values higher then 100
No, but the net effect might be accomplished creating/using mapped drives that are daisy chained, not a pretty solution. Otherwise, there do not appear to be many options as the Windows API can't be directly accessed from VBScript. Of course, you could write a COM object that uses the API, referencing that in your script, but that is over my head.