检查当前目录下是否存在指定的文件,如果存在就重新命名
添加时间: 2006-5-4 23:40:34 作者: ASP教程 阅读次数:75 来源: http://d9soft.com
<%
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")
%>
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")
%>
上下文章:
上一篇文章: MD5加密的javascript实现例子 下一篇文章: 使用asp实现支持附件的邮件系统(一)
相关文章:

