ASP检查某一文件是否存在

'检查某一文件是否存在
Function CheckFile(FilePath) 
  Dim fso
  'Filepath=Server.MapPath(FilePath)   '网站相对路径
  Set fso = Server.CreateObject("Scripting.FileSystemObject") '网络绝对路径
  If fso.FileExists(FilePath) then
  '存在
      CheckFile = True
  Else
  '不存在
      CheckFile = False
  End if
  Set fso = nothing
End Function

 

'检查目录是否存在
Function CheckDir(FolderPath)  
dim fso
'folderpath=Server.MapPath(".")&"\"&folderpath  '网站相对路径

Set fso = Server.CreateObject("Scripting.FileSystemObject") '网络绝对路径
If fso.FolderExists(FolderPath) then
'存在
    CheckDir = True
Else
'不存在
    CheckDir = False
End if
Set fso = nothing
End Function


<%
'------------------------- 
'--建立目录 网站相对路径
'---------------------- 
Function MakeNewsDir(byval foldername) 
    dim fso 
    Set fso = Server.CreateObject("Scripting.FileSystemObject") 
        fso.CreateFolder(Server.MapPath(foldername)) 
        If fso.FolderExists(Server.MapPath(foldername)) Then 
           MakeNewsDir = True 
        Else 
           MakeNewsDir = False 
        End If 
    Set fso = nothing 
End Function 

%>



 

'------------------------- 
'--建立目录 网络绝对路径
'---------------------- 
Function MakeNewsDir(byval foldername) 

		dim fso2 
        Set fso2 = Server.CreateObject("Scripting.FileSystemObject") 
        fso2.CreateFolder(up_SavePath) 
        If fso.FolderExists(up_SavePath) Then 
           MakeNewsDir = True 
		   Response.Write("目录已建立"& "<BR>")
        Else 
           MakeNewsDir = False 
		   Response.Write("目录未建立"& "<BR>")


        End If 
    Set fso2 = nothing 

	
End Function 



你可能感兴趣的:(ASP检查某一文件是否存在)