ASP代码之文件夹重命名

来源:互联网 发布:淘宝司法拍卖佣金 编辑:程序博客网 时间:2024/06/16 03:18
 <%Name1="原文件名"Name2="目标文件名"if Name1<>"" and Name2<>"" thenSub RenameFolder(ByVal strFolderPath, ByVal strNewName)Dim objFileSystemSet objFileSystem=Server.CreateObject("Scripting.FileSystemObject")' 如果路径不包含冒号, 则认为 strFolderPath 是虚拟路径.' 故调用 Server.MapPath() 方法将此路径转为绝对路径If Instr(1,strFolderPath,":")=-1 ThenstrFolderPath=Server.MapPath(strFolderPath)End IfDim objFolderSet objFolder=objFileSystem.GetFolder(strFolderPath)objFolder.Name=strNewNameSet objFolder=nothingSet objFileSystem=nothingEnd SubRenameFolder Server.MapPath(Name1),Name2response.write "已经成功地把 "+Name1+" 更名为 "+Name2+" !"end if%>

1 0
原创粉丝点击