[Solved] extract data from csv and rename files [closed]


First you must read the your CSV.. i suppose that is not too big, so do something like

Dim MyCSV() As String = IO.File.ReadAllLines("c:\my file.csv")

Then go ahead with a “For Each” line in your CSV

For Each Line In MyCSV.ToArray

Next

In this For Each you must split the current line.. and i suppose is a standard CSV so must be the “,” (i think)

Dim MySplitLine() As String = Line.Split(","c)

Finally (also in the For Each) you can rename your file with the new name

If IO.File.Exists("c:\folder 1\folder 2\" & MySplitLine(1) & ".extension") Then
FileSystem.Rename("c:\folder 1\folder 2\" & MySplitLine(1) & ".extension",
                  "c:\folder 9\folder 8\" & MySplitLine(0) & ".extension")
End If

Dont forget to set your extension.

1

solved extract data from csv and rename files [closed]