advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Partners & Affiliates
advertisement
advertisement
Tip of the Day
Expertise: Intermediate
Language: Visual Basic
February 24, 1999
Quirks of the Dir$ Function
If you use the intrinsic VB Dir$ function to check for the existence of a certain file, then subsequently try to remove the directory where the file is found using the VB RMDir statement, you get the error 75, "Path/File access error." This error occurs even if you kill the file prior to removing the directory.

You can see the problem if you manually create a directory and file with the names c:\dummy\bla-bla.txt. Then try to go step-by-step through this sample code to see what's going on:


Private Sub Command1_Click()
If Dir$("C:\dummy\bla-bla.txt") = "" Then
'do nothing, file is not found
Else
'kill the file and remove the directory
Kill "C:\dummy\bla-bla.txt"
RmDir "C:\dummy"
End If
End Sub

It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?





Brian Hunter
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
advertisement
advertisement