diff --git a/TruePath.SystemIo/PathIo.cs b/TruePath.SystemIo/PathIo.cs
index 9844a79..f32fc2e 100644
--- a/TruePath.SystemIo/PathIo.cs
+++ b/TruePath.SystemIo/PathIo.cs
@@ -743,6 +743,14 @@ public static class PathIo
/// An array of the full names (including paths) for the files in the specified directory that match the specified search pattern.
public static string[] GetFiles(this AbsolutePath path, string searchPattern) => Directory.GetFiles(path.Value, searchPattern);
+ ///
+ /// Returns the names of files (including their paths) that match the specified search pattern in the specified directory.
+ ///
+ /// The directory to search.
+ /// The search pattern to match against the names of files in .
+ /// An array of the full names (including paths) for the files in the specified directory that match the specified search pattern.
+ public static string[] GetFiles(this AbsolutePath path, LocalPathPattern searchPattern) => Directory.GetFiles(path.Value, searchPattern.Value);
+
#if NET8_0_OR_GREATER
///
/// Returns the names of files (including their paths) that match the specified search pattern and enumeration options in the specified directory.
diff --git a/TruePath.Tests/PathIoTests.cs b/TruePath.Tests/PathIoTests.cs
index d581fa8..9833816 100644
--- a/TruePath.Tests/PathIoTests.cs
+++ b/TruePath.Tests/PathIoTests.cs
@@ -40,6 +40,21 @@ public void ExistsFolderTest()
});
}
+ [Fact]
+ public void GetFilesByLocalPathPatternTest()
+ {
+ DoWithTempFolder(tempFolder =>
+ {
+ var matchingFile = tempFolder / "matching.txt";
+ matchingFile.WriteAllText("test");
+ (tempFolder / "other.log").WriteAllText("test");
+
+ var files = tempFolder.GetFiles(new LocalPathPattern("*.txt"));
+
+ Assert.Equal([matchingFile.Value], files);
+ });
+ }
+
private static void DoWithTempFolder(Action test)
{
var tempFolder = Temporary.CreateTempFolder();