Thread: Create Folder
View Single Post
  #1 (permalink)  
Old October 11th, 2006, 01:44 PM
jezywrap jezywrap is offline
Authorized User
 
Join Date: Dec 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create Folder

What I want is a quick script that will ask the user for a folder range. Lets say 58 - 78. What I'm getting is 00058, 000581, 000582 ... 00060, 000601 and so on. Could you give me an idea of what I'm doing wrong?

Dim Result1, Result2, x, Folder

Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Result1 = InputBox("Enter Begining Folder Number : ")
    Msgbox "Result1 equals " & Result1
    If Result1 = "" Then
        Wscript.Echo "No input was given"
        Result1 = InputBox("Enter Begining Folder Number : ")
    End If


    Result2 = InputBox("Enter Ending Folder Number : ")
    Msgbox "Result2 equals " & Result2
    If Result2 = "" Then
        Wscript.Echo "No input was given"
        Result2 = InputBox("Enter Ending Folder Number : ")
    End If

If Result1 > Result2 Then
    MsgBox "First number can't be greater than second number"
    Wscript.Quit()
Else
    x = Result1

    While x < Result2
        Folder = ""
        Folder = "000" & x
        Set objFolder = objFSO.CreateFolder("C:\Documents and Settings\jayers\Desktop\New Folder (2)\" & Folder)
        x = x + 1
    Wend
    MsgBox "Folders Created"
End If
MsgBox " x equals " & x
WScript.Quit()

Reply With Quote