DEV Community

Amr Azzam
Amr Azzam

Posted on

𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲 𝗯𝗲𝘁𝘄𝗲𝗲𝗻 * 𝗮𝗻𝗱 ** 𝗶𝗻 𝗳𝗶𝗹𝗲 𝗽𝗮𝘁𝗵𝘀?

Single and Double Asterisks are both wildcard characters, but they have different meanings:
(Single Asterisk):
The * character matches zero or more characters within a single directory name or filename.
It's typically used to match multiple files or directories based on a specific pattern within a single directory level.
For example, file*.txt would match file1.txt, file2.txt, etc., within the same directory.

** (Double Asterisks):
The ** character, often used in glob patterns, matches zero or more directories and files, recursively.
It's typically used to match files or directories across multiple directory levels.
For example, root/*/.txt would match all text files in any subdirectory of root, regardless of how deep they are nested.

In summary, * matches within a single directory level, while ** matches recursively across multiple directory levels.

Top comments (0)