Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Create Numerous Folders via a Batch File?

Posted on 2011-02-23
11
Medium Priority
?
681 Views
Last Modified: 2012-08-14
I created 70 folders for our properties but now face the daunting task of creating about 700 subfolders, one for each of our tenants.  I have a naming convention for each of these folders that I can pull from Filemaker - I just combine the PropCode and TenantCode fields to name the folder.  Is there a way to write a batch or VB script that will create these 700 subfolders?  Thank you.
0
Comment
Question by:rvfowler2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 34965969
Hi, this depends on the format of your list.  You would need a way to determine what folder is to be created where.  Could you elaborate on how you obtain the folder names, and whether you can determine which property folder to put them in?

Regards,

Rob.
0
 
LVL 2

Author Comment

by:rvfowler2
ID: 34966953
Yes, the naming structure is based on what I said above:  each tenant's folder is a combination of two fields in Filemaker:  PropCode and UnitCode, e.g., AB01.  Each tenant folder is within the property's folder which is a combo of 3 fields in Filemaker, e.g., AB400680.  All of these will be located in a TNTINFO folder on the R drive, thus a full file path for one tenant is
R:\TNTINFO\AB400680\AB01

Thanks so much for your help.
0
 
LVL 57

Expert Comment

by:Bill Prew
ID: 34966984
So, can you export a space or comma delimited text file from Filemaker that looks like:

AB400680,AB01

~bp
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Author Comment

by:rvfowler2
ID: 34966991
Sure.
0
 
LVL 57

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 34967030
Okay, export in that format (comma delimited) and save as a TXT file.  Use the following BAT file to make the directories.  Change the SET for the location of the TXT file as needed.

@echo off
set BaseDir=R:\TNTINFO
set DirList=C:\dirlist.txt
for /F "tokens=1,2 delims=," %%A in (%DirList%) do md "%BaseDir%\%%A\%%B"

Open in new window

~bp
0
 
LVL 2

Author Comment

by:rvfowler2
ID: 34967072
In fact, here's the file.
TNTFilePath.csv
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34967154
Bill's code looks like it will do the job. Do you want a VBS version of it?

Rob.
0
 
LVL 2

Author Comment

by:rvfowler2
ID: 34969980
Sure, I am somewhat familiar with VBS, just not DOS.
0
 
LVL 57

Expert Comment

by:Bill Prew
ID: 34971025
Easier to do from DOS though, since it will create any needed directories along the path, where VBS won't.  There are routines that do that, I'm sure Rob will whip up something, but in this case DOS does a little of that extra work for you.  Since you didn't express a preference in the question I went with the one that seemed the simplest and easiest fit.

~bp
0
 
LVL 2

Author Closing Comment

by:rvfowler2
ID: 34971248
Bill, You rock.  It worked.  Saved me about an hour.
0
 
LVL 57

Expert Comment

by:Bill Prew
ID: 34976021
Great, glad that BAT script got the job done, thanks.

~bp
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question