📄 fso.asp
字号:
<%'----------------FSO操作------------------------------
'读取文件
Function FSOFileRead(Template_Name)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(Template_Name),1,True)
If objCountFile.AtEndOfStream = false Then FSOFileRead = objCountFile.ReadAll
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function
'创建文件夹
Function CreateFolder(fldr)
on error resume next
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateFolder(Server.MapPath(fldr))
CreateFolder = f.Path
Set f=nothing
Set fso=nothing
End Function
'创建文件
Function createhtml(path,str)
GetFold=split(path,"/")
For e=0 to Ubound(GetFold)-1
if fldr="" then
fldr=GetFold(e)
else
fldr=fldr&"/"&GetFold(e)
end if
If IsFolder(fldr)=false then
CreateFolder fldr
End if
Next
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(path))
fout.Write str
fout.close
set fso = nothing
End Function
'删除文件夹
Function delfolder(path)
If IsFolder(path)=True Then
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder(server.mappath(path))
set fso = Nothing
End If
End Function
'删除文件
Function delfile(path)
If IsExists(path)=True Then
set fso = server.CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(server.mappath(path))
set fso = nothing
End If
End Function
'检测文件是否存在
Function IsExists(filespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(server.MapPath(filespec))) Then
IsExists = True
Else
IsExists = False
End If
Set fso=nothing
End Function
'检测文件夹是否存在
Function IsFolder(Folder)
Set fso = CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(server.MapPath(Folder)) Then
IsFolder = True
Else
IsFolder = False
End If
Set fso=nothing
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -