tommyt11
Member
I'm having difficulty finding exactly what I need.
I have code that gets Initial Path, Return Path and a List of FileNames with FullPath of filename
All works well, but in the list of filenames I need to trim or split the filenames to only have filename with extensions(no path)
I'm trying to do this as the object is created but cannot find anything to do this during the read line process.
Here is my code:
Not even sure if this is possible but would like to try if it is.
I have code that gets Initial Path, Return Path and a List of FileNames with FullPath of filename
All works well, but in the list of filenames I need to trim or split the filenames to only have filename with extensions(no path)
I'm trying to do this as the object is created but cannot find anything to do this during the read line process.
Here is my code:
Function MyFunction() On Error Resume Next Dim appData As String = System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) Dim mfnames As String = "" Dim f As Integer Dim mflines As System.IO.StreamReader mflines = My.Computer.FileSystem.OpenTextFileReader(appData & "myfile.txt") If System.IO.File.Exists(appData & "myfile.txt") = True Then Dim objReader As New System.IO.StreamReader(appData & "myfile.txt") Do While objReader.Peek() <> -1 mfnames = mfnames & objReader.ReadLine() & vbNewLine 'This returns me a line by line list such as D:/folder/subfolder/filename.ext but I would like it to trim to just (filename.ext). Note some paths may have different depths so I would like to trim from Last instance of char("/") Loop MsgBox(mfnames) Else MessageBox.Show("File Does Not Exist") End If End Function
Not even sure if this is possible but would like to try if it is.