Microsoft KB Archive/93057
Article ID: 93057
Article Last Modified on 11/21/2006
This article was previously published under Q93057
If you attempt to delete the current directory using the Basic RMDIR command, the incorrect run-time error 76 "Path not found" 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 "Path/File access error".
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.
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:
- The directory must be empty of other directories and/or files.
- You cannot delete the current directory.
Attempting to delete the current directory (whether empty or not) will cause run-time error 76, or "Path not found" 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, "Path/File access error" 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 "C:\TEMPDIR" CHDIR "C:\TEMPDIR" RMDIR "C:\TEMPDIR" END
- Run the program. A run-time error dialog box is displayed which contains a "Path not found" 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 "C:\TEMPDIR" CHDIR "C:\TEMPDIR" IF CURDIR$ <> "C:\TEMPDIR" THEN> RMDIR "C:\TEMPDIR" ELSE CHDIR ".." RMDIR "C:\TEMPDIR" END IF END
Additional query words: QuickBas BasicCom 4.50 1.00 7.10 buglist4.50 buglist1.00 buglist7.10