當前位置:編程學習大全網 - 網站源碼 - dreamweaver 如何批量替換源代碼文件

dreamweaver 如何批量替換源代碼文件

正則表達式不能提取文件名作為變量,可以試試VBS:sFolder = "."Set oFSO = CreateObject("Scripting.FileSystemObject")Set oFolder= oFSO.GetFolder(sFolder)Set colFiles = oFolder.FilesFor Each oFile in colFiles If Lcase(oFSO.GetExtensionName(oFile)) = "html" Then oName = Split(oFile.Name,".")(0) Set sFile = oFSO.OpenTextFile(oFile, 1) colLines = sFile.ReadAll sFile.Close aryLines = Replace(colLines, "1.jpg", oName & ".jpg") Set dtFile = oFSO.OpenTextFile(oFile, 2) dtFile.Write aryLines dtFile.Close End IfNextSet oFSO = Nothing代碼假設文件在同級文件夾,保存為VBS文件放到HTML文件夾,雙擊執行。如果不在同級文件夾,HI我以作修改。

  • 上一篇:上海地鐵用什麽掃碼坐地鐵
  • 下一篇:求放量切連續三天成交量般大的通達信選股公式!感謝!
  • copyright 2024編程學習大全網