Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
skiflirt
- Posts: 2
- Joined: 28 Nov 2014 17:01
#1
Post
by skiflirt » 28 Nov 2014 17:23
I'm looking for a solution to replicate the md command with enableextensions turned on. For some reason on a particular network storage device we're unable to create a directory with a single md command using a DFS/UNC path.
So as a work around I'd like to create a function that will take a full path (as a string) and iterate through the directory structure and 1) check if the directory exists, 2) if not, then create it, then repeating until the end of the path.
For example:
\\mynetworkname.net\mysite\archive\archive\foo1\foo2\foo3
bold is the root of the DFS path
in pseudo-code:
Code: Select all
for lnLoopCtr = 1 to <totalNumDirectories> (
lcCurrPath = <DFS path root> + <next directory name>
if not exist lcCurrPath (
md lcCurrPath
)
)
Hopefully this makes sense. If not please ask questions.
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#2
Post
by Squashman » 28 Nov 2014 21:30
I am not at work to test your theory on not being able to make UNC paths with one command but you can easily solve this by using the PUSHD command and then doing your make directory command.
Code: Select all
PUSHD "\\mynetworkname.net\mysite\archive"
md "archive\foo1\foo2\foo3"
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#3
Post
by foxidrive » 29 Nov 2014 00:38
skiflirt wrote:I'm looking for a solution to replicate the md command with enableextensions turned on. For some reason on a particular network storage device we're unable to create a directory with a single md command using a DFS/UNC path.
Hopefully this makes sense. If not please ask questions.
What error do you see on this device?
What command do you issue when the error occurs? Are there any non-latin characters in the name? Spaces?