asp下利用fso实现文件夹或文件移动改名等操作函(2)
if fso.fileexists(server.mappath(sPATH)) then
checkfile = true
else
checkfile = false
end if
set fso = nothing
end function
asp创建文件夹
function createdir(sPATH)
dim fso,pathArr,i,path_Level,pathTmp,cPATH
on error resume next
sPATH = replace(sPATH,"\","/")
set fso = server.createobject("scripting.filesystemobject")
pathArr = split(sPATH,"/")
path_Level = ubound(pathArr)
for i = 0 to path_Level
if i = 0 then pathTmp = pathArr(0) & "/" else pathTmp = pathTmp&pathArr(i) & "/"
cPATH = left(pathTmp,len(pathTmp)-1)
if not fso.folderexists(cPATH) then fso.createfolder(cPATH)
next
set fso = nothing
if err.number <> 0 then
err.clear
createdir = false
else
createdir = true
end if
end function
删除文件夹,这里是删除系统中栏目的文件夹
function delclassfolder(sPATH)
on error resume next
dim fso
set fso = server.createobject("scripting.filesystemobject")
if fso.folderexists(server.mappath(sPATH)) then
fso.deletefolder(server.mappath(sPATH))
end if
set fso = nothing
end function
删除新闻内容文件
function delnewsfile(sPATH,filename)
on error resume next
dim fso,tempArr,cPATH,ePATH,i:i = 0
set fso = server.createobject("scripting.filesystemobject")
sPATH = sPATH & filename & site_extname
内容版权声明:除非注明,否则皆为本站原创文章。