Sphexi

Untitled

May 25th, 2019
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Const ForReading = 1
  2. Const ForWriting = 2
  3.  
  4. Set oFileSys = WScript.CreateObject("Scripting.FileSystemObject")
  5. Set oFolder = oFileSys.GetFolder(".")
  6.  
  7. For Each file in oFolder.Files
  8.  
  9.     If Instr(file.name,".txt") > 0 Then
  10.    
  11.         Set objFile = oFileSys.OpenTextFile(file.path, ForReading)
  12.         strText = objFile.ReadAll
  13.         objFile.Close
  14.        
  15.         linesArray = Split(strText,vbCrLf)
  16.        
  17.         For each line in linesArray
  18.            
  19.             strNewText = strNewText & line & " | US" & vbCrLf
  20.        
  21.         Next
  22.        
  23.         strNewText = Left(strNewText,Len(strNewText)-2)
  24.        
  25.         Set objFile = oFileSys.OpenTextFile(file.path, ForWriting)
  26.         objFile.Write strNewText
  27.         objFile.Close
  28.         strNewText = ""
  29.        
  30.     End If
  31.    
  32. Next
RAW Paste Data