WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: chrislegarth on May 06, 2019, 08:16:22 AM

Title: DirMake vs. DirExist
Post by: chrislegarth on May 06, 2019, 08:16:22 AM
I am writing a script that will copy files to several servers.  What I am running into is that the DirMake command gives inaccurate results when a file with the same name exists as the directory I'd like to make.
DirMake reports that the directory is created successfully or in this case already exists.  The DirExist command properly returns that the directory does not exist.  Looks like a bug unless I am missing something.

Just an FYI...Thanks!
Title: Re: DirMake vs. DirExist
Post by: ChuckC on May 06, 2019, 09:58:33 AM
The NTFS file system stores names of directory entries[e.g. directories & files] in a case-exact manner, but does lookup/comparison of names in a case-ignore manner.  It is not permissible to have both a directory and a file with the same case-ignore name as siblings together under the same parent directory.  If a file already exists with the same name that you are using when trying to create a directory, that will result in an error.

Use the FileExist() function and DirExist() function together to test for the presence of either a file or a directory with the specified name before calling DirMake().
Title: Re: DirMake vs. DirExist
Post by: td on May 06, 2019, 10:29:45 AM
Quote from: chrislegarth on May 06, 2019, 08:16:22 AM
I am writing a script that will copy files to several servers.  What I am running into is that the DirMake command gives inaccurate results when a file with the same name exists as the directory I'd like to make.
DirMake reports that the directory is created successfully or in this case already exists.  The DirExist command properly returns that the directory does not exist.  Looks like a bug unless I am missing something.

Just an FYI...Thanks!

That one has been around for a few years.  It will be addressed in the next release and thanks for reporting the problem.