does any one here know of a good way to to determine whether or not a
given path is a directory (e.g., "c:\mydir") or a file (e.g., "c:\mydir
\myfile.txt")?
i started attacking this problem by using filesystemobject to check
whether or not a directory existed for the path. if so, it was a
directory path. if not, i checked to see if a file existed for it. if
so, it was a file path. this code is shown below:
''''''''''''''''''''''''''''''''''''
function GetPathType(byval sPath)
const INVALID = 0
const DIRECTORY = 1
const FILE = 2
dim iResult : iResult = INVALID
dim fso : set fso = CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(sPath) then
iResult = DIRECTORY
elseif fso.FileExists(sPath) then
iResult = FILE
end if
set fso = nothing
GetPathType = iResult
end function
''''''''''''''''''''''''''''''''''''
but, what if i need to determine a path type regardless of whether or
not the directory or file currently exists?
any ideas out there?
thanks in advance