VB.NET File Rename - Rename File Extensions of Multiple Files from .CBR Files to .RAR Files
This VB.NET tutorial with sample VB.NET project will display how developers can code to rename a file extension and rename multiple files on a hard disk using VB.NET codes.
I have a huge list of comic books downloaded in .CBR files extension format.
Since .CBR file type is actually means archived .RAR comic book file type, I wanted to code a VB.NET application to rename multiple files.
My requirement is to rename files in VB.NET from .CBR files extension to .RAR files extension as a batch file renaming process.
My VB.NET file rename software will take the folder path as an input argument.
After the path is identified, the file renaming application will store all the files with .CBR file extension in a VB.NET array.
Then the renaming files will be managed in a VB.NET For Each loop.
Each time looping in the array of selected files, the program will rename file extension from .cbr to .rar file extension.
And the VB.NET file rename application form design is as follows...
VB.NET File Rename Code
Here is the code in VB.NET to rename files in a given folder path.
You can use the below VB.NET application to rename multiple files with .cbr file extension to a file name with .rar file extension.
Dim files As String()
files = IO.Directory.GetFiles(TextBox1.Text, "*.cbr")
Dim filepath_new As String
For Each filepath As String In files
filepath_new = filepath.Replace(".cbr", ".rar")
As you will see in the above VB.NET code renaming a file can be easily managed by using .NET Framework method File.Move() in System.IO namespace.
This simple file renamer VB.NET code block can be used in a For Each loop as you see in the same VB code example, for batch file renaming or rename multiple files in a file folder.