Extracting drive, path filebasename or extension from complete filename?

  • Thread starter Thread starter Thomas Lebrecht
  • Start date Start date
T

Thomas Lebrecht

Assume I have a full filename like

myfile="D:\aaa\bbb\ccc\ddd.txt"

How can I extract the individual parts (drive, path, filenbase and extension) from it?

How do I get the path and filenam of the current vbs script from inside this script?

Thomas
 
Thomas Lebrecht said:
Assume I have a full filename like

myfile="D:\aaa\bbb\ccc\ddd.txt"

How can I extract the individual parts (drive, path, filenbase and
extension) from it?

How do I get the path and filenam of the current vbs script from inside
this script?

See

System.IO.Path.Get*

methods.

If you like a different answer, don't post to the VB.Net group
(m.p.dotnet.languages.vb)


Armin
 
Assume I have a full filename like

myfile="D:\aaa\bbb\ccc\ddd.txt"

How can I extract the individual parts (drive, path, filenbase and extension) from it?

How do I get the path and filenam of the current vbs script from inside this script?

Thomas

In VB.NET (because it seems posted to vb.net group):

Dim path As String = "D:\aaa\bbb\ccc\ddd.txt"

' To get Drive letter
System.IO.Path.GetPathRoot(path)

' To get whole path
System.IO.Path.GetFullPath(path)

' To get extension
System.IO.Path.GetExtension(path)

'...more on System.IO.Path as previously said.

HTH,

Onur Güzel
 
Back
Top