当前位置:首页 > ASP源码 > ASP经典代码,文件夹重命名
Sep11th

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

jeson ASP源码 0

 

<%

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

%>

本文出自:好东西分享,地址:http://www.17558.net/post/10.html,转载须注明!

to "ASP经典代码,文件夹重命名"

此楼已盖到第0层了,目前尚未封顶!