<%
Dim fso,folders,files,f,i
Set fso = server.CreateObject("Scripting.FileSystemObject")
Set folders = fso.GetFolder(server.mappath("pic")) '获取pic文件夹对象
set files=folder.files '获取pic文件夹下所有文件
i=1
for each f in files
f.name="图片"&i&".jpg"
i=i+1
next
这样应该可以的,不过要自己调试一下
<%@ Language=VBScript %>
<%
function bianli(path)
dim fso 'fso对象
dim objFolder '文件夹对象
dim objSubFolders '子文件夹集合
dim objSubFolder '子文件夹对象
dim objFiles '文件集合
dim objFile '文件对象
set fso=server.CreateObject("scripting.filesystemobject")
on error resume next
set objFolder=fso.GetFolder(path)'创建文件夹对象
set objSubFolders=objFolder.Subfolders'创建的子文件夹对象
for each objSubFolder in objSubFolders
nowpath=path + "/" + objSubFolder.name
Response.Write nowpath
set objFiles=objSubFolder.Files
i=10
for each objFile in objFiles
i=i+1
thefilename=nowpath&"/"&i&".txt"
'response.write(thefilename)
Response.Write "<br>---"
Response.Write objFile.name
filename=nowpath&"/"&objFile.name
'filename=path
fso.movefile filename,thefilename
response.write"<br>---"
response.write thefilename
next
Response.Write "<p>"
bianli(nowpath) '调用递归
next
set objFolder=nothing
set objSubFolders=nothing
set fso=nothing
end function
%>
<%
bianli("d:/bianli") '调用bianli()函数,这里是遍历d:
%>
可以呀,
方法一:
<%
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile server.mappath("tupian.jpg"),server.mappath("图片.jpg")
Set fso=Nothing
%>
方法二:
<%
Dim fso,f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(server.mappath("tupian.jpg"))
f.name="图片.jpg"
Set f=Nothing
Set fso=Nothing
%>