'判断文件夹是否存在 Function FolderExits(Folder)
Folder=Server.Mappath(Folder) Set FSO= Server.CreateObject("Scripting.FileSystemObject") IF FSO.FolderExists(Folder) Then
FolderExits=true Else
FolderExits=false EndIF End Function
'判断文件是否存在 Function FileExits(FileName)
FileName=Server.Mappath(FileName) Set FSO= Server.CreateObject("Scripting.FileSystemObject") IF FSO.FileExists(FileName) Then
FileExits=true Else
FileExits=false EndIF End Function
'创建文件夹 Function CreateFolder(Folder) onerrorresumenext
Folder=Server.Mappath(Folder) Set FSO = Server.CreateObject("Scripting.FileSystemObject")
FSO.CreateFolder(Folder) if err>0then
err.clear
CreateFolder=False else
CreateFolder=True endif End function
'创建文件 Function CreateFile(FileName,Content) onerrorresumenext
FileName=Server.Mappath(FileName) Set FSO = Server.CreateObject("Scripting.FileSystemObject") set fd=FSO.createtextfile(FileName,true)
fd.writeline Content if err>0then
err.clear
CreateFile=False else
CreateFile=True endif End function
'删除文件 function DeleteFile(FileName) onerrorresumenext Set FSO = Server.CreateObject("Scripting.FileSystemObject") if FSO.FileExists(FileName) then
FSO.DeleteFile FileName,true endif if err>0then
err.clear
DeleteFile=False else
DeleteFile=True endif end function
'删除文件夹 function DeleteFolder(Folder) onerrorresumenext
Folder=server.MapPath(Folder) Set FSO = Server.CreateObject("Scripting.FileSystemObject") if FSO.FolderExists(Folder) then
FSO.Deletefolder Folder,true endif if err>0then
err.clear
Deletefolder=False else
Deletefolder=True endif end function