Storages & Files GetFilePath
GetFilePath method 

Extracts the directory path which contains the file/directory.


variable = object.GetFilePath(filepath)


filepath - File or directory specification - usually full path name.


Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
fn = sf.GetFilePath("C:\dir\dir1\file.txt")
' Result is "C:\dir\dir1\"
fn = sf.GetFileName("C:\dir\dir1")
' Result is "C:\dir\"
fn = sf.GetFileName("C:\dir\dir1\")
' Result is "C:\dir\dir1\"


The method can be used to extract file or directory names as well. Its behavior for directories depends on the syntax used - if there is trailing "\" in the passed path specification the file/directory name is empty

Note that the analysis performed is textual - the operation can be performed on existing and non-existing objects. This allows the method to be used in code intended to "plan" future file/directory creation tasks for example.

Applies to: SFMain object

Supported on:

Windows 95/NT and later
Windows CE 3.0 and later
Pocket PC/Windows Mobile 2003 and later
Windows CE.NET 4 and later


newObjects Copyright 2001-2006 newObjects [ ]