From 87e0e889e7b4524de4c544a4fb7d7d84a20e4061 Mon Sep 17 00:00:00 2001 From: Sylphrena <86712892+BigBoyBarney@users.noreply.github.com> Date: Wed, 6 Nov 2024 22:31:22 +0100 Subject: [PATCH 1/2] Added simple glob example --- src/dir/glob.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dir/glob.cr b/src/dir/glob.cr index cd45f0a03baf..4fb8803fa499 100644 --- a/src/dir/glob.cr +++ b/src/dir/glob.cr @@ -37,6 +37,10 @@ class Dir # Returns an array of all files that match against any of *patterns*. # + # ``` + # Dir.glob "path/to/folder/*.txt" # Returns all files in the folder that end in ".txt". + # Dir.glob "path/to/folder/**/*" # Returns all files in the target folder and its subfolders. + # ``` # The pattern syntax is similar to shell filename globbing, see `File.match?` for details. # # NOTE: Path separator in patterns needs to be always `/`. The returned file names use system-specific path separators. From 137d2803f4ed61434939255b616281f4c01731da Mon Sep 17 00:00:00 2001 From: Sylphrena <86712892+BigBoyBarney@users.noreply.github.com> Date: Wed, 6 Nov 2024 22:32:56 +0100 Subject: [PATCH 2/2] Fixed typo --- src/dir/glob.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dir/glob.cr b/src/dir/glob.cr index 4fb8803fa499..2fc8d988c20a 100644 --- a/src/dir/glob.cr +++ b/src/dir/glob.cr @@ -38,7 +38,7 @@ class Dir # Returns an array of all files that match against any of *patterns*. # # ``` - # Dir.glob "path/to/folder/*.txt" # Returns all files in the folder that end in ".txt". + # Dir.glob "path/to/folder/*.txt" # Returns all files in the target folder that end in ".txt". # Dir.glob "path/to/folder/**/*" # Returns all files in the target folder and its subfolders. # ``` # The pattern syntax is similar to shell filename globbing, see `File.match?` for details.