VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Check for existing Directories/Folders


Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (10 Votes)

Check if that directory exists before running the risk of an error and/or data loss. One of the few that really works. No API, no function calls. Existence check and logic included. Incredibly simple.

Side Effects
None known

Rate Check for existing Directories/Folders

'By Jim Sivage 
'
'ISO Global
'http://www.isoglobal.com
'
'
'Make f$ equal to folder you're testing.
'
f$ = "C:\WINDOWS"
dirFolder = Dir(f$, vbDirectory)
If dirFolder <> "" Then
 strmsg = MsgBox("This folder already exists.", vbCritical):goto optout
End If
'directory exists action here
optout:

Download this snippet    Add to My Saved Code

Check for existing Directories/Folders Comments

No comments have been posted about Check for existing Directories/Folders. Why not be the first to post a comment about Check for existing Directories/Folders.

Post your comment

Subject:
Message:
0/1000 characters