J
John Dann
Is there any method in the File, Directory, FileInfo, Path etc classes
that makes it easy to retrieve the folder name of the immediate parent
folder of a file? I can't see one, but maybe I've missed it in all the
various overlapping methods and properties. For example, I might have
the file:
C:\Folder1\Folder2\Folder3\MyFile.txt
I want to be able to retrieve Folder3 into a string, no backslashes
etc, just 'Folder3'.
Obviously I can do this with various string search functions on the
full file path, but is this the only option or might there be a more
elegant approach
JGD
that makes it easy to retrieve the folder name of the immediate parent
folder of a file? I can't see one, but maybe I've missed it in all the
various overlapping methods and properties. For example, I might have
the file:
C:\Folder1\Folder2\Folder3\MyFile.txt
I want to be able to retrieve Folder3 into a string, no backslashes
etc, just 'Folder3'.
Obviously I can do this with various string search functions on the
full file path, but is this the only option or might there be a more
elegant approach
JGD