mirror of
https://github.com/jbranchaud/til
synced 2026-01-06 00:28:01 +00:00
Add Find All Files With A Specific Extension With fd as a Unix TIL
This commit is contained in:
24
unix/find-all-files-with-a-specific-extension-with-fd.md
Normal file
24
unix/find-all-files-with-a-specific-extension-with-fd.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Find All Files With A Specific Extension With fd
|
||||
|
||||
The best way with [`fd`](https://github.com/sharkdp/fd) to match on files with
|
||||
a specific extension is to use the `-e` flag.
|
||||
|
||||
Here is how you'd find all `.ts` files:
|
||||
|
||||
```bash
|
||||
$ fd -e ts
|
||||
```
|
||||
|
||||
You can use the flag multiple times to specify multiple file extensions. This
|
||||
will turn up all TypeScript and JavaScript files:
|
||||
|
||||
```bash
|
||||
$ fd -e ts -e js
|
||||
```
|
||||
|
||||
Alternatively, you can use regex in the filename pattern to match on several
|
||||
file extensions like so:
|
||||
|
||||
```bash
|
||||
$ fd '.*\.(js|ts|jsx|tsx)$'
|
||||
```
|
||||
Reference in New Issue
Block a user