Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Const ForReading = 1
- Const ForWriting = 2
- Dim a, b, c, D 'declaring variables
- Set fs = CreateObject("Scripting.FileSystemObject")
- Set f = fs.GetFolder(InitialPath)
- Set fc = f.SubFolders
- InitialPath = "C:...." 'geting subfolders
- For Each f1 in fc
- Set TicFileFolder = fs.GetFolder(InitialPath & "" & f1.Name) 'geting files inside the subfolders
- Set TicFiles = TicFileFolder.Files
- For Each TicFile in TicFiles
- If (UCase (left (TicFile.name, 4)) = "TIC_") then
- Wscript.echo "Handling file " & InitialPath & "" & f1.Name & "" & TicFile.name
- Set objFile_Rec = fs.OpenTextFile("C:UsersKarimYEXTVideosrelais_CODOitem_codo.txt", ForReading)
- Set objFile = fs.OpenTextFile(InitialPath & "" & f1.Name & "" & TicFile.name, ForReading)
- strNewContents = ""
- Do Until objFile.AtEndOfStream
- strLine = objFile.ReadLine
- strLine = objFile.ReadLine
- If (InStr(strLine, "|") > 0) Then 'Get fuling point number
- a = split(strLine,"|")
- b = a(4)
- c = a(5)
- if (b = c) and Len(b) = 13 then
- Do Until objFile_Rec.AtEndOfStream
- strLine = objFile_Rec.ReadLine
- If InStr(strLine, b) > 0 Then
- D = strLine
- end if
- end if
- Loop
- objFile_Rec.Close
- If InStr(strLine, b & "|" & c) > 0 Then
- strLine = Replace (strLine, b & "|" & c, D) 'replace data
- Wscript.echo "ReplacingMartnoforitem" & b
- End if
- strNewContents = strNewContents & strLine & vbCrLf
- 'Loop
- end if
- objFile.Close
- wscript.sleep (10)
- Set objFile = fs.OpenTextFile(InitialPath & "" & f1.Name & "" & TicFile.name, ForWriting)
- objFile.WriteLine strNewContents
- objFile.Close
- Loop
- End if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement