replicating a set of subfolders

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
wildcat50k
Posts: 1
Joined: 11 Sep 2009 12:02
Location: Delaware, USA

replicating a set of subfolders

#1 Post by wildcat50k » 11 Sep 2009 12:04

The company I work for has created a folder for each of the clients we have (folder name = client name). Recently in a staff meeting we decided that to standardize on organization, the client folders (350 of them already there) should all have 7 standard subfolders within each one, for example- Contracts, Correspondence, Projects, etc. Creating these 7 subfolders inside any NEW client folders is easy, but we want to know if there is a way to auto-create these 7 standard subfolders inside the 350 existing client folders, so someone doesn’t have to break their arm off trying to do it manually.

Many of these client folder names have commas and spaces, which has been throwing off attempts trying to use the FOR command.

Any suggestions?

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 11 Sep 2009 14:29

**UNTESTED**

Code: Select all

@echo off
set "parentdir=f:\clients"
set folders="pleadings" "correspondence" "misc and other" "briefs" "templates" "final" "pending"

cd /d "%parentfolder%"
for /d %%a in (*) do (
   for /f %%b in (%folders%) do md "%%~a\%%~b" >nul 2>nul
)

Post Reply