<%
function JudgeFileExit(strFileName)
Dim objFSO,objFile,objFJ
Dim strFilePath
Dim blFJ
Dim intFlag
intFlag=0
set objFSO=CreateObject("Scripting.FileSystemObject")
strFilePath=server.MapPath("./")
if right(strFilePath,1)<>"/" or right(strFilePath,1)<>"\" then
strFilePath=strFilePath&"\"
end if
blFJ=objFSO.FileExists(strFilePath&strFileName)
do while blFJ=true
intFlag=intFlag+1
blFJ=objFSO.FileExists(strFilePath &intFlag&strFileName)
loop
if intFlag=0 then
JudgeFileExit= strFileName
else
JudgeFileExit=intFlag&strFileName
end if
set objFSO=nothing
end function
Response.Write JudgeFileExit("22.htm")
%>
本文介绍了一个使用VBScript编写的函数,该函数用于判断指定路径下的文件是否存在,并在文件存在时检查是否有同名文件并带有数字后缀。如果找到这样的文件,则递增数字后缀直至找到不存在的文件。
6万+

被折叠的 条评论
为什么被折叠?



