Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
It checks to see if a directory exists. If it does...
Author:
KrazyGamer
E-mail:
Click to e-mail author
Website:
http://krazygamer.cjb.net
Submitted:
10/11/2002
Version:
VB5
Compatibility:
VB5, VB6
Category:
Miscellaneous
Views:
8351
It checks to see if a directory exists. If it doesn't, it will try to create it. Can be used to create entire structures.
Declarations:
'none
Code:
Function NewDirIfInexistent(Path As String) As Integer '************************ ' This function was created by KrazyGamer (krazygamer@hotmail.com) ' ' It checks to see if a directory exists. If it doesn't, it will ' try to create it. Can be used to create entire structures. '************************ 'Return values: ' 0 = path already exists ' 1 = new path was created ' 2 = path does not exist and could not be created Dim strPath As String, x As Integer If Right$(Path, 1) <> "\" Then Path = Path & "\" On Local Error GoTo 10 If Dir(Path, vbDirectory) <> "" Then NewDirIfInexistent = 0 Else 5 x = InStr(x + 1, Path, "\") If x > 0 Then strPath = Left$(Path, x) If Dir(strPath, vbDirectory) = "" Then MkDir (strPath) GoTo 5 End If NewDirIfInexistent = 1 End If Exit Function 10 NewDirIfInexistent = 2 End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement