Imports System
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'leggo il file lista.txt
Try
Using sr As StreamReader = New StreamReader(Application.StartupPath & "\lista.txt")
Dim line As String
'creo l evento che mi legge le righe
Do
line = sr.ReadLine()
' facio terminare il prg alla fine
If line = "" Then
Exit Do
End If
'MsgBox("Riga: " & line)
'creo le due stringhe
Dim linea As String
linea = line
'divido la stringa
Dim parti() As String = linea.Split(";")
'controllo se esiste la foto
If My.Computer.FileSystem.FileExists(parti(0) & ".jpg") Then
'MsgBox("Il file esiste")
My.Computer.FileSystem.RenameFile(parti(0) & ".jpg", parti(1) & ".jpg")
Else
'MsgBox("Manca il file: " & parti(1) & ".jpg")
End If
'MsgBox(parti(0))
Loop
MsgBox("Fine Programma")
End Using
Catch ex As Exception
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class