File Path Class

R

R Avery

Does anyone have a nice file path class that can work regardless of
whether or not the path exists? The MS Scripting Runtime object model
provides file and folder objects which are good, but they don't work on
hypothetical paths... also, I think they introduce more overhead than a
simple Path class would that merely stores the current path and can
return new path classes to its parent or to its children, or can return
it's FullName optionally with or without the drive, path, name, extension...

Any help would be appreciated!
 
T

Tom Ogilvy

If using at least xl2000 or later, why not just use split

vArr = Split(sPath,"\")

ext = split(varr(ubound(varr)),".")(1)
name = split(varr(ubound(varr)),".")(0)
 
R

R Avery

That would be the method internal to the Path class. The reason why I
want a class to do this is that it is tedious to, for example, get the
path of the parent's parent folder. I would have to take the ubound of
the array, iterate over each element in the array until ubound-3,
properly join them with the appropriate path separator, etc. I just
want a one-line command to do it, since I have to do it all the time.

Also, a class could be designed to handle UNIX, Windows, and (perhaps)
Mac paths natively. It could also have built in functions to test
whether or not the path exists, if it is a folder or file, return a
scripting.file object corresponding to the path, etc.
 
Top