1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Create folder from text file with VBscript

Discussion in 'General Programming Chat' started by Ruriko, Aug 27, 2012.

  1. Ruriko

    Ruriko Power Member

    Joined:
    May 4, 2008
    Messages:
    524
    Likes Received:
    12
    I am trying to make a script that will read from a text file and create those folders. In my text file it contains:

    Code:
    C:\Users\Susan\Documents\iMacros\Downloads\(C82) [Imperial Chicken (Fujisaka Kuuki)] OZ (Neon Genesis Evangelion)[Decensored][English]
    C:\Users\Susan\Documents\iMacros\Downloads\(C82) [Hachiouji Kaipan Totsugeki Kiheitai (Makita Yoshiharu)] Just Want Moyashi! (Nisekoi, Raikkonen no Nettaigyo) (English)
    C:\Users\Susan\Documents\iMacros\Downloads\[Shimekiri Sanpunmae (Tsukimi Daifuku)] Ichika I'll Make You Feel Good (Infinite Stratos) (Eng) [Life4Kaoru]
    C:\Users\Susan\Documents\iMacros\Downloads\[Nakayohi Mogudan (Mogudan)] Gentei Omakehon 2005.2 (Neon Genesis Evangelion) [ENG] [LWB]
    C:\Users\Susan\Documents\iMacros\Downloads\(C82) [Kuronishiki (Takaharu)] A.Tsu.I.Yo.Ru (Touhou Project) [English] [CGrascal]
    C:\Users\Susan\Documents\iMacros\Downloads\(COMIC1☆6) [Dokuebi. (Antaresu 11)] Despair☠Pirates (Mouretsu Pirates) [English] =LWB=
    C:\Users\Susan\Documents\iMacros\Downloads\(C82) [Type-G (Ishigaki Takashi)] Ore to NanoFei to One Room (Mahou Shoujo Lyrical Nanoha StrikerS) [English] =TV + Afro=
    C:\Users\Susan\Documents\iMacros\Downloads\[Kesshoku Mikan] Cobalt Delphinium (English) (Resident Evil) {doujin-moe.us}
    C:\Users\Susan\Documents\iMacros\Downloads\[Clesta (Cle Masahiro)] CL-orz 23 (Kyoukai Senjou no Horizon) [English] [doujin-moe.us]
    C:\Users\Susan\Documents\iMacros\Downloads\(C82) [Number2 (Takuji)] Datte Aniki wa Nama Ecchi Suki damon (Ore no Imouto ga Konna ni Kawaii Wake ga Nai) [English] [PineApples R' Us + Doujin-Moe.us]
    C:\Users\Susan\Documents\iMacros\Downloads\(C82) [Number2 (Takuji)] Damette Ittemo Nakadashi Surundesuyone (Ore no Imouto ga Konna ni Kawaii Wake ga Nai) [English] [PineApples R' Us + Doujin-Moe.us]
    
    This is the script. Can anyone help me fix it?

    Code:
    dim objFileSys, objReadFile
    Const ForReading = 1, ForWriting = 2, ForAppending = 8
    
    Set objFileSys = CreateObject("Scripting.FileSystemObject")
    Set objReadFile = objFileSys.OpenTextFile("C:\Users\Susan\Documents\iMacros\Macros\file.txt", ForReading)
    
    Do until objReadFile.AtEndOfStream = True
        objFileSys.CreateFolder(objReadFile.ReadLine)
    
    Loop
    objReadFile.Close
    Set objReadFile = Nothing
    Set objFileSys = Nothing
    I get this error when I try to run it http://i.imgur.com/4zrlZ.jpg
     
    Last edited: Aug 27, 2012