Daily Links and Annotations 04/14/2009

  • Script to rename all files in a directory… to e.g. replace underscores with spaces… I altered to do the reverse.

    tags: no_tag

    • ‘========================================================
      ‘ VBScript to replace underscore in file name with space
      ‘ for each files in a folder
      ‘ Written by ApOgEE of http://coderstalk.blogspot.com
      Dim sName
      Dim fso
      Dim fol

      ‘ create the filesystem object
      Set fso = WScript.CreateObject(“Scripting.FileSystemObject”)

      ‘ get current folder
      Set fol = fso.GetFolder(“.”)

      ‘ go thru each files in the folder
      For Each fil In fol.Files
      ‘ check if the file name contains underscore
      If InStr(1, fil.Name, “_”) <> 0 Then
      ‘ replace underscore with space
      sName = Replace(fil.Name, “_”, ” “)
      ‘ rename the file
      fil.Name = sName
      End If

      ‘ echo the job is completed
      WScript.Echo “Completed!”

      • Worked like a charm. I altered it to do the reverse. – post by ideadude

Posted from Diigo. The rest of my favorite links are here.