Batch Folder Creation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We are re-structuring part of our network folder system and need to find the
most efficient way to create the new structure. For example each client will
have their own folder, with the same set of sub-folders in each client
folder. I have been working with creating Windows Scripts to try and
automate this, but can not figure out how in have the script read a CSV file
listing all the clients names, or the name of each set of folders that needs
to be create. Has anyone does this successfully before, examples, of know of
any 3rd part tools? Thank you

AL Durham
 
Al Durham said:
We are re-structuring part of our network folder system and need to find the
most efficient way to create the new structure. For example each client will
have their own folder, with the same set of sub-folders in each client
folder. I have been working with creating Windows Scripts to try and
automate this, but can not figure out how in have the script read a CSV file
listing all the clients names, or the name of each set of folders that needs
to be create. Has anyone does this successfully before, examples, of know of
any 3rd part tools? Thank you

AL Durham

A good starting point would be to post a sample of your CSV files.
 
The CSV file would be a basic listing of our clients, so I can not post the
actual file since that is confidential company information. Do you have
experience creating scripts that use CSV files?
 
Al Durham said:
The CSV file would be a basic listing of our clients, so I can not post the
actual file since that is confidential company information. Do you have
experience creating scripts that use CSV files?

I did not ask for actual data; I suggested that you should post
a sample of your CSV file. Depending on its structure, a simple
batch file may be able to do the trick.
 
Pegasus-

The CSV fiel would simply list the clients, for example:

"client 1", "client 2", "client 3"

We would want to create a folder labled with a clients name, and then have
the same set of subfolders in each folder that is created. For example:

Client 1
-Administration
--Calls
--Tickets
-Accounting
--Invoices
--Puchase Orders

Thanks for your help on this.
 
Try this batch file:

@echo off
set ListFile=c:\names.txt
set TargetFolder=d:\Client Shares

for /F "tokens=* delims=," %%* in (%ListFile%) do call :Parse %%*

goto :eof

:Parse
set name=%1
set name=%name:~1,-1%
echo md "%TargetFolder%\%name%\Administration"
echo md "%TargetFolder%\%name%\Calls"
echo md "%TargetFolder%\%name%\Tickets"
echo md "%TargetFolder%\%name%\Accounting"
echo md "%TargetFolder%\%name%\Invoices"
echo md "%TargetFolder%\%name%\Purchase Orders"
pause
shift
if x%1x==xx (goto :eof) else (goto Parse)
 
Back
Top