Microsoft KB Archive/93057

= Trying to Delete Current Directory Gives Path Not Found Error =

Article ID: 93057

Article Last Modified on 11/21/2006



This article was previously published under Q93057



SYMPTOMS
If you attempt to delete the current directory using the Basic RMDIR command, the incorrect run-time error 76 &quot;Path not found&quot; is returned. This error is returned even if the entire absolute path is provided. The correct error to return under this condition is run-time error 75, or &quot;Path/File access error&quot;.



STATUS
Microsoft has confirmed this to be a bug in Microsoft QuickBasic for MS- DOS, version 4.5; in Microsoft Basic Professional Development System (PDS) for MS-DOS, version 7.1; and in Microsoft Visual Basic programming system for Windows, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The Basic RMDIR command is used to delete an existing directory from disk. In order for this command to function properly, the following requirements must be met:


 * 1) The directory must be empty of other directories and/or files.
 * 2) You cannot delete the current directory.

Attempting to delete the current directory (whether empty or not) will cause run-time error 76, or &quot;Path not found&quot; to be generated. Error 76 is not the correct error that should be reported, and is misleading. Instead the correct run-time error of 75, &quot;Path/File access error&quot; should be returned.

The following steps can be used to reproduce this problem:

  Start QB.EXE, QBX.EXE, or VB.EXE and enter the following code: MKDIR &quot;C:\TEMPDIR&quot; CHDIR &quot;C:\TEMPDIR&quot; RMDIR &quot;C:\TEMPDIR&quot; END  Run the program. A run-time error dialog box is displayed which contains a &quot;Path not found&quot; error.

To work around this problem, check the value of the CurDir$ function and compare it to the directory to be deleted. If the directories are different, it is safe to delete the directory. If the directories are the same, you must change to a different directory before executing the RMDIR command. The following code demonstrates this workaround: MKDIR &quot;C:\TEMPDIR&quot; CHDIR &quot;C:\TEMPDIR&quot; IF CURDIR$ <> &quot;C:\TEMPDIR&quot; THEN> RMDIR &quot;C:\TEMPDIR&quot; ELSE CHDIR &quot;..&quot; RMDIR &quot;C:\TEMPDIR&quot; END IF END

Additional query words: QuickBas BasicCom 4.50 1.00 7.10 buglist4.50 buglist1.00 buglist7.10

Keywords: KB93057

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.