A path traversal library to match a file by moving up the directory structure from a start folder
$ dotnet add package LSL.PathTraversalThis library provides a static method for enumerating up a directory hierarchy from a given initial path or the current directory if no initial path is provided.
The following example attempts to locate a file in the hierarchy, starting from
the value of Directory.GetCurrentDirectory():
// Necessary usings:
using LSL.PathTraversal;
...
var fileInfo = TraversePath.Enumerate()
// GetFileInfo is an extension method to the DirectoryInfo class
.Select(directoryInfo => directoryInfo.GetFileInfo(filename))
.FirstOrDefault(fileInfo => fileInfo.Exists)
// If the file was found then fileInfo will provide all information
// otherwise fileInfo will be null