Batch file to create directory tree in MS-DOS 6.21

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

Batch file to create directory tree in MS-DOS 6.21

#1 Post by Clueless in Seattle » 08 Dec 2013 13:39

I suspect that the answer to this is right in front of me, but everything I've tried has failed.

What I'm trying to do is write a batch file in MS-DOS 6.21 that will copy a directory tree from drive E: to drive D:

But, I don't want to copy any of the files in the directories on E:, I just want to copy empty directories.

Here's an example of a tree I'd like to copy:

    E:\TRUNKDIR\BRANCH1\BRANCH1a\

I plan to enter the directory path as a parameter on the DOS command line when I run the batch file. So, if the batch file were named MAKETREE.BAT, then the command line might look something like this:

    E:\>MAKETREE D:\TRUNKDIR\BRANCH1\BRANCH1a\

I've tried using MD, with and without that last backslash, and with and without the drive letter, but it keeps giving me error messages.

I can get it to work with XCOPY, but XCOPY copies all the files in the sub-directories. And I don't want that. I want to create empty directories on the D: drive. My antique version of MS-DOS seems to lack the /T switch for XCOPY that would tell it to copy directories only..

I'd be grateful if someone could help me figure out a way to do this,

Will in Seattle
a.k.a. "Clueless"

aGerman
Expert
Posts: 4743
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Batch file to create directory tree in MS-DOS 6.21

#2 Post by aGerman » 08 Dec 2013 14:48

Unfortunately I'm not familiar with DOS anymore. I guess you could use XCOPY though. Try to copy NUL.

Code: Select all

XCOPY NUL D:\TRUNKDIR\BRANCH1\BRANCH1a /I


Regards
aGerman

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file to create directory tree in MS-DOS 6.21

#3 Post by foxidrive » 08 Dec 2013 19:15

In MSDOS you cannot create multiple levels of directory in one command.

To create D:\TRUNKDIR\BRANCH1\BRANCH1a you can do this

Code: Select all

MD D:\TRUNKDIR
MD D:\TRUNKDIR\BRANCH1
MD D:\TRUNKDIR\BRANCH1\BRANCH1a


I think the way to go about this in those days was to use DIR to create a list of directories in a text file and use QBASIC to parse it and create the folders.

Post Reply