蜻蜓手游网小编最近把系统从PHP改成ASP的系统,原来老的系统中的图片地址做了跳转处理。
比如请求的文件名是 http://pic.qtsyw.com/up/bak/ab17580b53edb0248cce640143b8bce9.png 但是实际上在服务器上面的路径是 /ab/17580b53edb0248cce640143b8bce9.png 访问的时候把基中的 目录名字当成文件名来访问,小编想了很外整理了一个简单的VBS脚本来处理,希望能给正好有这个需求的朋友一个提示。
'on error resume next
dim k,oFso,currentpath
k=0
set oFso=createobject("scripting.filesystemobject")
Function FilesTree(oSubFolder) '遍历一个文件夹下的所有文件夹文件夹
dim sPath,sName
sPath = oSubFolder.Path
sName = oSubFolder.Name
Set oFolder = oFso.GetFolder(sPath)
Set oFiles = oFolder.Files
For Each oFile In oFiles
' Msgbox oFile.Path
'oFile.Delete
oFso.copyfile oFile,currentpath+"\back\"+sName +oFile.Name
Next
Set oFolder = Nothing
Set oSubFolders = Nothing
' Set oFso = Nothing
End Function
currentpath = createobject("Scripting.FileSystemObject").GetFolder(".").Path
Set oFolder = oFso.GetFolder(currentpath)
Set oSubFolders = oFolder.SubFolders
For Each oSubFolder In oSubFolders
if (oSubFolder.Name<>"back")then
FilesTree(oSubFolder)'递归
end if
Next
需要代码的就直接下载吧 http://pic.qtsyw.com/up/2018-11/2018117234326280.txt
热门评论
最新评论