1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Help with Batch File for creating subfolders

Discussion in 'Windows XP' started by fenningenari, May 29, 2005.

Thread Status:
Not open for further replies.
Advertisement
  1. fenningenari

    fenningenari Thread Starter

    Joined:
    May 29, 2005
    Messages:
    3
    Hello,
    I am trying to write a batch file that will create subfolders based on the name of the parent folder. So if the folder that I am working in is named "dg2001-10-19" then I want the batch file to create 3 subfolders named "dg2001-10-19 - WTA", "dg2001-10-19 - BHMM" and "dg2001-10-19 - files". In the other folders that I am working in I want it to work the same way - for a folder named "disc" it would create "disc - WTA", "disc - BHMM" and "disc - files" and place them in the disc folder.

    If anyone can help me I would really appreciate it. I realize that this is probably a simple thing but I am not very familiar with programming or batch files. Thank you very much for your help.
     
  2. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,409
    If you're in the folder and you run the batch there, try this:

    <content of <BUILDSUB.BAT>
    MD WTA
    MD BHMM
    MD files

    This should work in any folder to create those three sub-folders.
     
  3. fenningenari

    fenningenari Thread Starter

    Joined:
    May 29, 2005
    Messages:
    3

    Thanks for the reply, I appreciate it. That won't work though. I don't want to make a folder named "WTA" I want to make a folder named the same thing as the parent folder except with " - WTA" added to the end of it. For instance, if the folder that I am in is named "jg1980-10-01" then I want for the subfolders to be named "jg1980-10-01 - WTA" and "jg1980-10-01 - BHMM" and "jg1980-10-01 - files". See what I mean?

    I don't know how to tell the batch file that part of the name of the folder should be exactly the same as the folder that I am currently in, but the rest of the folder name should be a constant, like " - WTA".

    Again, thank you for your reply. Any ideas?
     
  4. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,409
    Well, you weren't all that clear, so I guessed. :)

    I'd probably use a batch enhancer to do this trick. if you're running this under Windows, you can do all of this and more with AutoIt.
     
  5. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,731
    I can script this so easily in Linux shell script. I always have a hard time converting that over into batch files.
     
  6. pr0t3st

    pr0t3st

    Joined:
    Apr 17, 2005
    Messages:
    457
    Here try this batch script:

    The best I could come up with ...
     
  7. fenningenari

    fenningenari Thread Starter

    Joined:
    May 29, 2005
    Messages:
    3
    Thanks for the help guys. I got it working now. I appreciate all your help.
     
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/366557