3 replies
by dklippert
I have not tried these. No guarantees.
Here?s a line of code that may help:
?...(assuming your list of directories is in dirlist.txt, one per line)...
FOR /F "tokens=1 delims=`" %i in (dirlist.txt) DO md "%i"
(the tokens and delims is soin case you have spaces in the dir names, and the double quote in the md command are for the same reason). Note that in WinNT and Win2K you can do a command such as:
md c:\topdir\2nddir\3rddir\4thdir
...and it makes the entire tree, no need to make c:\topdir and then c:\topdir\2nddir, etc.
Here?s another bat file I found in a forum. The author is William Allen.
::====MAKEDIRS.BAT
@ECHO OFF
IF NOT EXIST %1 GOTO:ERROR GOTO ERROR
IF NOT EXIST }T\NUL MD }T
:: Note the extra " character on this line, that's
:: all that's needed to handle names with spaces.
ECHO @PROMPT MD ">}T\}1.BAT
TYPE %1 >>}T\}1.BAT
CD }T
PATH>}R.BAT
SET PATH=
CTTY NUL
%COMSPEC%/c }1>}2.BAT
CALL }2
CTTY CON
CALL }R
CD..
deltree/y }T>NUL
ECHO The list of directories is created.
GOTO END
:ERROR
ECHO Command line argument needed as follows:
ECHO %0 filename.ext
ECHO where filename.ext is the directory list.
ECHO.
ECHO Note that you must make Teacher's directory before
ECHO his/her pupils' directories, so use list format thus:
ECHO C:\Mr Applied Maths
ECHO C:\Mr Applied Maths\S. Root
ECHO C:\Mr Applied Maths\N. Distribution
ECHO C:\Mr Applied Maths\E. I. Pi
ECHO C:\Miss Quantum Physics
ECHO C:\Miss Quantum Physics\E. Capture De Cay
ECHO C:\Miss Quantum Physics\N. Bohr (no relation)
ECHO C:\Miss Quantum Physics\O. Neutron Bomb
ECHO C:\Ms Predicate Calculus
ECHO C:\Ms Predicate Calculus\M. Tolens
ECHO C:\Ms Predicate Calculus\M. Ponens
ECHO C:\Ms Predicate Calculus\Axiom Schema
ECHO.
:END
::====
by linux surfer
by linux surfer
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending