Skip to content

Instantly share code, notes, and snippets.

@jkatricak
Created February 3, 2011 20:57
Show Gist options
  • Save jkatricak/810178 to your computer and use it in GitHub Desktop.
Save jkatricak/810178 to your computer and use it in GitHub Desktop.
Rename all files in a directory with one extention to another extension
'Convert .ddb files to .bdb for camera backup software
'Note: this script must be in the same directory
'(normally _DDB_) as the files you want to convert.
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFS = CreateObject("Scripting.FileSystemObject")
strCurrentFolder=WshShell.CurrentDirectory
Dim fso, f, f1, fc, s
Dim i
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(strCurrentFolder)
Set fc = f.Files
i = 0
For Each f1 in fc
filesplit = Split(f1.Name,".")
If filesplit(1) = "ddb" Then
fso.MoveFile f1.Name,filesplit(0) & ".bdb"
i = i+1
End If
Next
msgbox("Done!" & vbcrlf & vbclrf & "Renamed " & i & " files.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment