Mass Renamer application

vicenzoster

New member
Joined
May 3, 2006
Messages
1
Programming Experience
1-3
hi all, i wanna make a program, the program is for mass rename file,... i have some problem here is the problem
1. what the function in VB.NET to rename all file in the directory??
i was declare system.io.file and system.io.filestream

2. in the program i have a tree view, it function for display all directory of windows like as windows explorer
but i dont know the syntax that will display the directory (root), how can i display it??

plz help me, anyone can solve this problem??
thanks for all....
:confused::confused::confused::confused::confused::confused::confused:
 
Seems dangerous to rename all files in a directory..you could perhaps
by mistake be in the wrong directory. I'd do it a file at a time, using
recursive sub to dig into each folder of folders.

In regards to the TreeView there is a thread where I'm talking to myself
where the last comment on how to iterate a treeview may help
http://www.vbdotnetforums.com/showthread.php?t=11544&highlight=printrecursive
 
I had to do this recently for e-mail messages that got stuck in a hold folder. Here is the code I used:

VB.NET:
    Private Sub btnRenameFiles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRenameFiles.Click
        Windows.Forms.Cursor.Current = Cursors.WaitCursor
        For Each foundFile As String In My.Computer.FileSystem.GetFiles(My.Application.Info.DirectoryPath, FileIO.SearchOption.SearchTopLevelOnly, "*.smd")
            Dim foundFileInfo As New System.IO.FileInfo(foundFile)
            If foundFileInfo.Name.Replace(".smd", "").IndexOf(".") > -1 Then
                My.Computer.FileSystem.DeleteFile(foundFileInfo.FullName, FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin)
            End If
            Dim arrTemp As String() = foundFileInfo.Name.Split(CChar("."))
            Dim newName As String = arrTemp(5).ToString & ".smd"
            My.Computer.FileSystem.RenameFile(foundFileInfo.FullName, newName)            
        Next
        Windows.Forms.Cursor.Current = Cursors.Default
        MessageBox.Show("Done")
        Me.Close()
    End Sub

P.S. This code was used for a slightly different purpose, but it will get you in the right direction.
 
if youre looking for a great implementation of this particular wheel that has already been invented, try renamer 6, or renamer NG from www.albert.nu

NG is still in beta, as it's albert's conversion of Renamer6 in C to RenamerNG in C#, but if you know C# and you ask albert nicely, he'll give the source code if it doesnt do what you require
 
Back
Top