<%
Dim I
Dim A()
Dim FSO
Dim FSO_File
Dim FileFullName
Dim FilePath
Dim HTTP_HOST
HTTP_HOST=Request.ServerVariables("HTTP_HOST")
'response.write(Request.ServerVariables("HTTP_HOST")&"<Br>")
'response.write(Request.ServerVariables("URL")&"<Br>")
FilePath=LEFT(Server.Mappath(Request.ServerVariables("PATH_INFO")),InStrRev(Server.Mappath(Request.ServerVariables("PATH_INFO")), "\"))
FileFullName = FilePath & "FileName.txt"
'读取旧的文件名目录(文件目录保存在FileName.txt)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.OpenTextFile(FileFullName,1,FALSE,FALSE)
Do While Not FSO_File.AtEndOfStream
ReDim Preserve A(i)
A(i)=FSO_File.ReadLine
i=i+1
Loop
FSO_File.Close
Set FSO_File=Nothing
Set FSO=Nothing
'重命名文件
Function ReName(File1,File2)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
FSO.MoveFile File1, File2
'FSO.DeleteFile File1
Set FSO_File=Nothing
Set FSO=Nothing
End Function
Dim j
Dim B()
Dim Name
Dim NewFileName
For j= 0 to ubound(A)
Randomize timer
Name=int(rnd*1000000)
ReDim Preserve B(j)
'新的文件名
B(j)=Name & ".htm"
FileName=FilePath&A(j)
NewFileName=FilePath&B(j)
ReName FileName,NewFileName
Response.write("<a href=http://"&HTTP_HOST&"\qita\autofilename\"&B(j)&">网页"&j&"</a><br>")
Next
'写入文件名目录(文件目录仍保存在FileName.txt)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.CreateTextFile(FileFullName,TRUE,FALSE)
For j= 0 to ubound(B)
FSO_File.writeLine B(j)
Next
FSO_File.Close
Set FSO_File=Nothing
Set FSO=Nothing
%>
Dim I
Dim A()
Dim FSO
Dim FSO_File
Dim FileFullName
Dim FilePath
Dim HTTP_HOST
HTTP_HOST=Request.ServerVariables("HTTP_HOST")
'response.write(Request.ServerVariables("HTTP_HOST")&"<Br>")
'response.write(Request.ServerVariables("URL")&"<Br>")
FilePath=LEFT(Server.Mappath(Request.ServerVariables("PATH_INFO")),InStrRev(Server.Mappath(Request.ServerVariables("PATH_INFO")), "\"))
FileFullName = FilePath & "FileName.txt"
'读取旧的文件名目录(文件目录保存在FileName.txt)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.OpenTextFile(FileFullName,1,FALSE,FALSE)
Do While Not FSO_File.AtEndOfStream
ReDim Preserve A(i)
A(i)=FSO_File.ReadLine
i=i+1
Loop
FSO_File.Close
Set FSO_File=Nothing
Set FSO=Nothing
'重命名文件
Function ReName(File1,File2)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
FSO.MoveFile File1, File2
'FSO.DeleteFile File1
Set FSO_File=Nothing
Set FSO=Nothing
End Function
Dim j
Dim B()
Dim Name
Dim NewFileName
For j= 0 to ubound(A)
Randomize timer
Name=int(rnd*1000000)
ReDim Preserve B(j)
'新的文件名
B(j)=Name & ".htm"
FileName=FilePath&A(j)
NewFileName=FilePath&B(j)
ReName FileName,NewFileName
Response.write("<a href=http://"&HTTP_HOST&"\qita\autofilename\"&B(j)&">网页"&j&"</a><br>")
Next
'写入文件名目录(文件目录仍保存在FileName.txt)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.CreateTextFile(FileFullName,TRUE,FALSE)
For j= 0 to ubound(B)
FSO_File.writeLine B(j)
Next
FSO_File.Close
Set FSO_File=Nothing
Set FSO=Nothing
%>
预览地址:http://www.tiancao.net/qita/autofilename/index.asp
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |