Link to home
Start Free TrialLog in
Avatar of networkn
networkn

asked on

Script for directory creation

Hi There!

I need to create our 2014 folders in 2 folders of every client in our client folder.

The directory structure is h:\clients\alphabet number (A, B, C etc)\client name\correspondence and create 2014 at this level

Second Dir Structure is the same but under h:\clients\alphabet number (A, B, C etc)\client name\documentation and create 2014 at this level.

I guess the logic would be, go through directory structure and when you find documentation or correspondence in the directory name, create a 2014 folder under it.

Ideally it might create a list of the folders it had created in a log and where so if it goes wrong we can reverse it :)
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of networkn
networkn

ASKER

Doesn't seem to recognise the second folder for some reason? Correspondence was created not documentation
Works fine here; do the "Documentation" folders exist already? The "2014" folders will only be created if the target folders exist already.
Ugh, my fault, misread the email I was sent. All good thanks.
Awesome!
A little simpler would be perhaps to use a specific dir command then use that to make the dirs, does this give the right dirs for you?

dir /b /ad /s *correspondence* *documentation*

If so then

@echo off
for /f "tokens=*" %%d in ('dir /b /ad /s *correspondence* *documentation*') do md "%%~d\2014" 2>NUL

Steve
I delayed posting there seeing only the original post of course, would have built on above to log but you have solution anyway it seems.

Steve