comp • gb • file • dir

File.Dir (gb)

Static Function Dir ( Path As String ) As String

Returns the directory component of a file path.

This example will display information about a file path selected by the user. It uses the methods File.Name, File.BaseName, File.Ext and File.Dir.


Public Sub ButtonDisplayPath_Click()
  If Dialog.OpenFile() Then Return
  Print "Full file path: " & Dialog.Path
  Print "File name (with extension): " & File.Name(Dialog.Path)
  Print "File name (without extension): " & File.BaseName(Dialog.Path)
  Print "File extension: " & File.Ext(Dialog.Path)
  Print "Directory of the file: " & File.Dir(Dialog.Path)