John Topley's Knowledgebase

Extract A File Name From A Path

Friday, 30 May 2003

This Visual Basic code extracts a file name from a file path. For example, ExtractFileName("C:\Winnt\calc.exe") returns "calc.exe"

Download 0005.txt

Private Function ExtractFileName(ByVal vStrFullPath As String) As String
   Dim intPos As Integer
   intPos = InStrRev(vStrFullPath, "\")
   ExtractFileName = Mid$(vStrFullPath, intPos + 1)
End Function

top | index | previous | next | comments ()

home | archive | kb | media | about | contact | accessibility
Copyright © 2003 - 2005 John Topley. Made with CityDesk.