'------------------------------------- 'Create a multi-level directory, you can create a non-existing root directory' parameter: The directory name to create, can be a multi-level 'return logic value, True Success, FALSE Failed' Create the root of the directory from the current directory '--- ---------------------------------------------- Function CreateMultiFolder (ByVal CFolder) Dim objFSO, PhCreateFolder, CreateFolderArray, CreateFolder Dim i, ii, CreateFolderSub, PhCreateFolderSub, BlInfo BlInfo = False CreateFolder = CFolder On Error Resume Next Set objFSO = Server.CreateObject ( "Scripting.FileSystemObject") If Err Then Err. Clear () exit function end if createfolder = replace (CreateFolder, "/", "/") if left (createfolder, 1) = "/" THEN CREATEFOLDER = Right (CreateFolder, Len (CreateFolder) -1) End ifnesser (CreateFolder, 1) = "/" Then CreateFolder = Left (CreateFolder, Len (CreateFolder) -1) End If CreateFolderArray = Split (CreateFolder, "/") For i = 0 to UBound (CreateFolderArray) CreateFolderSub = "" For ii = 0 to i createfoldersub = createfoldersub & createfolderarray (ii) & "/" Next phcreatefoldersub = server.mappath (createfoldersub) if not objfso.foldere XISTS (PhcreateFoldersub) of objfso.createfolder (phcreatefoldersub) end if next if err dam Endiff () else blinfo = true end if createmultifolder = BlinfoEnd FUNCTION
'Instructions:
Response.Write Createmultifolder ("/ UPLOAD / 2005/3/26 /") & "
"
Response.write Craetemultifolder ("Upload / 2005/3/26")
The return value of the 'function is True (success) or false (failure, can be the host does not support FSO function)