Extracting the directory path from the full path of the file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

Given a full path name of a file, is there a command to extract the
directory path (without the file name)?

Thanks.
kd
 
Hi, based on your previous post I guess this is a console application. You
could do the following

Dim strStartupDir As String = CurDir()

Dim strFileName As String = "MyFileName.exe"

MsgBox(Replace(strStartupDir, strFileName, ""))
 
kd said:
Given a full path name of a file, is there a command to extract the
directory path (without the file name)?

\\\
Imports System.IO
..
..
..
Dim s As String = Path.GetDirectoryName("C:\foo\bar.txt")
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top