How the ASP detects if a directory exists, does not exist, and creates it itself
Folder=server.mappath ("/imagess")
Set fso = CreateObject ("Scripting.FileSystemObject")
If Fso.fileexists (Server.MapPath (filepath)) then
Respnse.write ("Everything is Built")
Else
Fso.createfolder (folder)
End If
Set FSO = Nothing
Dim objFSO
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
If objfso.folderexists (Server.MapPath (savepath)) =false Then
Objfso.createfolder (Server.MapPath (Savepath))
End If
Folder=server.mappath ("/imagess")
Set fso = CreateObject ("Scripting.FileSystemObject")
If Fso.fileexists (Server.MapPath (filepath)) then
Respnse.write ("Everything is Built")
Else
Fso.createfolder (folder)
End If
Set FSO = Nothing
' Create a new directory (agree to create without levels) 1:35 2005-1-31
Public Function CreateFolder (folderpath)
Dim sobjfso
Dim arrfolder
Dim i
Set sobjfso = Server.CreateObject (" Scripting.FileSystemObject ")
FolderPath = Replace (FolderPath," \ ","/")
Arrfolder = Split ( FolderPath, "/")
on Error Resume next
For i = 0 to UBound (arrfolder)
If i > 0 then arrfol Der (i) = Arrfolder (i-1) & "/" & Arrfolder (i)
If not sobjfso.folderexists (Arrfolder (i)) then
Sobjfso.createfolder (Arrfolder (i))
End if
next
CreateFolder = true
If Err.Number <> 0 then
CreateFolder = false
err.clear
End if
End Function
Create a Directory
Dim Fso,savepath
Savepath=server. MapPath (". \" &imagefile& "\" &username& "\" &specialname& "")
Set fso = server. CreateObject ("Scripting.FileSystemObject")
If FSO. FolderExists (Savepath) =false Then
Fso.createfolder (Savepath)
End If
Set fso=nothing
Delete Directory
Dim Fso,savepath
Savepath=server. MapPath (". \" &imagefile& "\" &username& "\" &specialname& "")
Set fso = server. CreateObject ("Scripting.FileSystemObject")
If FSO. FolderExists (Savepath) =true Then
Fso.deletefolder (Savepath)
End If
Set fso=nothing
Copy files
Dim fso
Set Fso=server. CreateObject ("Scripting.FileSystemObject")
Sub CopyFiles (PATH,PATH2)
Set Mycopy=fso.getfile (PATH)
Response.Flush ()
Mycopy.copy path2
Response.Write ("<b>installed success! </b>" &path2& "<br>")
Response. Flush ()
End Sub
Call CopyFiles (Server.MapPath (". /Untitled 2.bmp ")," D:\ site project \photo\aspupload\07_images\ ")
How the ASP detects if a directory exists, does not exist, and creates it itself