title: Renaming Multiple XML files using VBScript
body: <p>I've got a directory full of XML archives. 
  Something like 400 XMLs, and I need to rename each one of them with data that is present on them, using VBScript.</p>
  
  <p>I have done some code that functions, but still got problems:</p>
  
  <p><strong>@EDIT</strong> -> Solved. I found a "Replace" function. Thanks, Ekkehard!</p>
  
  <ul>
  <li>Some of the nodes' values that I use for renaming the file have illegal characters ("/", more precisely), what makes VBScript unable to save it, returning a "Path not found" error. How could I manage to change every "/" (if they exist in the present Operadora that is assumed in the variable) for each "Operadora" value before using it to rename the file? I would change it to "-". </li>
  </ul>
  
  <p>Here is the code:</p>
  
  <pre><code>Dim Caminho
  Dim FSO
  Dim FLD
  Dim fil
  Dim nomeErrado
  Dim nomeCerto
  Dim xmlDoc
  Dim OrganisationInfo, Operadora, recentDate, resultOperadora
  
  Set xmlDoc = CreateObject("Msxml2.DOMDocument.6.0") 'Msxml2.DOMDocument / Microsoft.XMLDOM   
  xmlDoc.Async = "False"
  xmlDoc.setProperty "SelectionLanguage", "XPath"
  
  Caminho = "C:\Users\f8057612\Desktop\Bancos\Script_Operadoras"
  
  Set FSO = CreateObject("Scripting.FileSystemObject")        'Create the instance of the FSO
  Set FLD = FSO.GetFolder(Caminho)                            'Set the folder you want to search. NOTE - some antivirus may not like this
  
  For Each fil in FLD.Files
      If LCase(FSO.GetExtensionName(fil)) = "xml" Then
          xmlDoc.Load fil.Path
          nomeErrado = fil.Path
  
          If xmlDoc.ParseError = 0 Then
  
              For Each OrganisationInfo In xmlDoc.SelectNodes("//OrganisationInfo/OrganisationName")
                  Operadora = OrganisationInfo.Text
              Next
  
              resultOperadora = Replace(Operadora, "/", "-")
  
              nomeCerto = "IR21 - " &amp; resultOperadora &amp; " - " &amp; ".xml"
              WScript.Echo "_" &amp; nomeErrado &amp; "_" &amp; vbNewLine &amp; "_" &amp; nomeCerto &amp; "_"
  
              FSO.MoveFile nomeErrado, nomeCerto
  
          End If
      End If
  Next
  
  Set FLD = Nothing
  Set FSO = Nothing
  </code></pre>