回复 48# pyj521
11年的老帖子了 ,这是来挖坟来着
FindAllFile(@ScriptDir)
Func _Re2File($File)
Local $FileNew = $File
Local $str = FileRead($File)
$str = StringReplace($str, '<item id="From"><![CDATA[DAJIAHAO (http://www.baidu.com/)]]></item>', _
'<item id="From"><![CDATA[NIHAO (http://www.360.com/)]]></item>')
$str = StringReplace($str, '<item id="copyright"><![CDATA[还好吗|www.baidu.com]]></item>', _
'<item id="copyright"><![CDATA[都很好|www.360.com]]></item>')
Local $hFO = FileOpen($FileNew, 2)
FileWrite($hFO, $str)
FileClose($hFO)
EndFunc ;==>_Re2File
Func FindAllFile($sDir)
Local $hSearch = FileFindFirstFile($sDir & "\*.*")
; 检查搜索是否成功
If $hSearch = -1 Then Return
While 1
Local $sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
If @extended Then
FindAllFile($sDir & "\" & $sFile)
ContinueLoop
EndIf
If StringRegExp($sFile, ".*\.xml", 0) Then
_Re2File($sDir & "\" & $sFile)
EndIf
WEnd
FileClose($hSearch); 关闭搜索句柄
EndFunc ;==>FindAllFile
|