1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| strdossier = "chemin_repertoire_a_parcourir"
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder(strdossier)
For Each objFile In objFolder.Files
strFilePath = objFile.Path
If LCase(objFso.GetExtensionName(strFilePath)) = LCase(strExtension) Then
Set objTempStream = objFso.OpenTextFile(strFilePath, 1)
Set objTempNewFile = objFso.CreateTextFile(strFilePath & ".temp", 2)
Do While NOT objTempStream.AtEndOfStream
strTemp = objTempStream.ReadLine
strTemp = Lcase(strTemp)
If Instr(strTemp, strToSearch) = 0 Then
objTempNewFile.WriteLine strTemp
'msgbox strtemp
ElseIf Instr(strTemp, strToyes) = 0 Then
objTempNewFile.WriteLine schaine2
objTempNewFile.WriteLine "END"
Else
objTempNewFile.WriteLine schaine3
objTempNewFile.WriteLine "END"
end if
loop
objTempStream.Close
objTempNewFile.Close
objFile.Delete
objFso.MoveFile strFilePath & ".temp", strFilePath
End If
Next
End Function
Wscript.Echo "Fin du programme" |