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

Windows How to create folders from a text/table list?

Discussion in 'Software' started by voodoo2k4, 6 Aug 2010.

  1. voodoo2k4

    voodoo2k4 Ghetto Modder

    Joined:
    21 Apr 2004
    Posts:
    316
    Likes Received:
    2
    Hi Guys,

    Calling all hard core geeks. Here is a good one for you...

    I need to create a few hundred folders on a networked drive. Each folder named after a provider on my database. Barnados, NSPCC, Action for Children etc ( I can export the names to notepad or whatever form needed).

    Is it possible to do this without installing an app? (work PC restrictions) On XP by the way.

    If not what app/batch do I need? I would prefer to create the folders with 3 sub folders in each too. One called contracts one called monitoring and one called documents. This isnt essential though.

    Help greatly appreciated or else its gonna be a long week next week!

    Much love,

    Dean.
     
  2. Zoon

    Zoon Hunting Wabbits since the 80s

    Joined:
    12 Mar 2001
    Posts:
    5,888
    Likes Received:
    824
    Bit of vbscripting should do the job nicely.

    To save time programming it you could just export the names to a text file, cast them into an array, and then loop the folder create method.

    http://www.activexperts.com/activmo...ts/filesfolders/folders/#CreateNewFolders.htm

    That's some sample code that'll do it, from a "its possible" aspect.

    By doubling up the code you can create your subfolders (ie, inside the loop, copy this code sample, add a "1" to the end of objFolder and make your first subfolder, 2 for your second, 3 for your third, etc.

    I don't know enough about windows shell scripting to give you the full thing though.
     
  3. Dudey109

    Dudey109 Minimodder

    Joined:
    20 May 2010
    Posts:
    197
    Likes Received:
    3
    Pretty simple, export the names to a .txt file on separate lines of the text file.
    In this example the names are stored in a .txt file called file.txt

    Make a batch file called anything mines batch.bat, real inventive.

    It basically goes through each line of the text file and makes the line into a variable, it creates the folder using the variable value and then forgets the variable and goes to the next line and repeats, it skips any empty lines and finishes at the bottom of the text file. Create thousands of folders in seconds! :)
    You can follow this idea to create the subfolders your looking at making also, if you cant do this I might be able to help, might be good to learn so see if you can work it out yourself :)

    I would test this on a local machine to make sure it works, and you know how its creating them before you go playing with a live server :)
     
    thehippoz likes this.
  4. thehippoz

    thehippoz What's a Dremel?

    Joined:
    19 Dec 2008
    Posts:
    5,780
    Likes Received:
    174
    nice dudey =]
     
  5. voodoo2k4

    voodoo2k4 Ghetto Modder

    Joined:
    21 Apr 2004
    Posts:
    316
    Likes Received:
    2
    Dude.......

    You my friend are a total and complete ledgend! :)

    It works beatifully and doesnt trigger and work security.

    I will now try and work out how to create standard sub folders in each on creation but will likely struggle. EPIC FAIL!

    If anyone want to point me in the right direction -much kudos. Buit to be fair its allready saved me at least a days work.

    Our penny poinching government thanks you for these efficiency savings! Who knows maybe Dave will let me keep my job!

    Hmmm sub folders..... :)

    Thanks,

    Dean.
     
  6. voodoo2k4

    voodoo2k4 Ghetto Modder

    Joined:
    21 Apr 2004
    Posts:
    316
    Likes Received:
    2
    You were right. Doing sub-dirs wasnt very difficult!

    Done and dusted - sweet as a nut etc etc.

    Dean.
     
  7. Dudey109

    Dudey109 Minimodder

    Joined:
    20 May 2010
    Posts:
    197
    Likes Received:
    3
    Glad I could be some help :)
     

Share This Page