#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2007
    Posts
    8
    Rep Power
    0

    Create folder from text file with Vbscript


    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
    http://i.imgur.com/4zrlZ.jpg
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    289
    Rep Power
    44
    Your problem is with the directory names. For reasons unknown to me, the brackets are converted to angle brackets, which are an illegal character unless they are inside quotes. Also, if spaces are encountered that are not inside quotes, more than one directory will be created. Do the directory names need to be so convoluted?

    J.A. Coutts

IMN logo majestic logo threadwatch logo seochat tools logo