Storages & Files GetFileName
GetFileName method 

Extracts the file/directory name from the passed parameter

Syntax:

variable = object.GetFileName(path)

Parameters:

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

Examples:

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

Remarks:

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 [ ]