极品分享

ASP教程:ASP经典代码,文件夹重命名

<% Name1="原文件名" Name2="目标文件名" if Name1<>"" and Name2<>"" then Sub RenameFolder(ByVal strFolderPath, ByVal strNewName) Dim objFileSystem Set objFileSystem=Server.CreateObject("Scripting.FileSystemObject") ' 如果路径不包含冒号, 则认为 strFolderPath 是虚拟路径. ' 故调用 Server.MapPath() 方法将此路径转为绝对路径 If Instr(1,strFolderPath,":")=-1 Then strFolderPath=Server.MapPath(strFolderPath) End If Dim objFolder Set objFolder=objFileSystem.GetFolder(strFolderPath) objFolder.Name=strNewName Set objFolder=nothing Set objFileSystem=nothing End Sub RenameFolder Server.MapPath(Name1),Name2 response.write "已经成功地把 "+Name1+" 更名为 "+Name2+" !" end if %>
2012-02-19 0 /
ASP学习
/
标签: 

评论回复

回到顶部