|
1 members (Russ),
10,950
guests, and
1,516
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
S |
M |
T |
W |
T |
F |
S |
|
|
|
1
|
2
|
3
|
4
|
5
|
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
|
27
|
28
|
29
|
30
|
31
|
|
|
|
|
This is another custom island. This one could be used for ads. This spot is one of the best places for ads on your site to be placed. This can be enabled/disabled on a per forum basis.
|
|
|
|
Joined: Dec 1999
Posts: 30,868
Master Elite Member
|
Public Function CreateFolderRecursive(ByVal FolderSpec As String) As Boolean
'Function
' Used to create folders recursivly.
'Parameters
' FolderSpec (String) = The complete spec of the folder to create.
' Example: c:\newfolder\anotherfolder\yetanotherfolder
' If there are 1 or more backslashes (\) at the end, they are ignored.
'Return (Boolean)
' Returns True if all folders were created and no error occured.
' Returns False if any error occured.
'Exit Conditions
' The Err object is clear if no errors occured.
' The Err object contains error information if any errors occured.
'Notes
' If some of the folders specified in the FolderSpec already exist, those folders are not changed.
' Only the folders which do not exist and which are necessary to complete the FolderSpec are created.
' This function works only when FolderSpec contains a leading drive letter.
' It will not work with network URLs.
'Version History
' 1.0 8/7/2003 Tested by Russ Tanner
'---
'Initiate variables
Dim xPath As String 'name of the current folder to create
Dim X As Integer 'index of the next backslash
'Default return value
CreateFolderRecursive = False
'Use inline error trapping
On Error Resume Next
Err.Clear
'Main loop
Do
'Parse the next folder name
X = InStr(FolderSpec, "\") 'get the index of the first path delimiter
'The foldespec does not contain another path delimiter
If X = 0 Then
xPath = xPath & "\" & FolderSpec
FolderSpec = ""
'The folderspec contains another path delimiter
Else
xPath = xPath & IIf(xPath <> "", "\", "") & Left(FolderSpec, X - 1)
FolderSpec = Mid(FolderSpec, X + 1)
End If
'Create folder if it doesn't already exist
If Dir(xPath, vbDirectory) = "" Then
'Create the folder
MkDir xPath
'Trap: Error occured, return False and exit now
If Err.Number <> 0 Then Exit Function
End If
Loop While FolderSpec <> ""
'No errors occured, return True
CreateFolderRecursive = True
End Function
|
|
|
|
|