Repository: material-ui
Issue: [scripts] cannot generate api docs for only one file
Labels: bug 🐛,core

### Duplicates

- [X] I have searched the existing issues

### Latest version

- [X] I have tested the latest version

### Current behavior 😯

Running `yarn docs:api --help` shows the following descriptions, but it also clears and remove all existing api-docs files. 

```bash
formats codebase

Options:
  --help  Show help                                                    [boolean]
  --grep  Only generate files for component filenames matching the pattern. The
          string is treated as a RegExp.                                [string]
```

And running `yarn docs:api --grep "some regexp"` result in the same issue: all api docs removed, and I can't seem to make it work, for example I want to generate api docs for MenuItemUnstyled, neither works (perhaps I did something wrong? I am not familiar with RegExp)

```bash
# using api docs name
yarn docs:api --grep menu-item-unstyled

# using component name
yarn docs:api --grep MenuItemUnstyled
```

Below error is thrown

```bash
Error: ENOENT: no such file or directory, scandir 'path-to-repo\material-ui\docs\pages\base\api'
    at Object.readdirSync (fs.js:1047:3)
    at getAllFiles (path-to-repo\material-ui\docs\scripts\/buildApi.ts:54:21)
    at findApiPages (path-to-repo\material-ui\docs\scripts\/buildApi.ts:71:17)
    at Object.getApiPages (path-to-repo\material-ui\docs\scripts\/buildApi.ts:139:24)
    at path-to-repo\material-ui\docs\scripts\/buildApi.ts:247:63
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at path-to-repo\material-ui\docs\scripts\/buildApi.ts:170:5
    at Object.run [as handler] (path-to-repo\material-ui\docs\scripts\/buildApi.ts:169:3) {
  errno: -4058,
  syscall: 'scandir',
  code: 'ENOENT',
  path: 'path-to-repo\\open-source\\material-ui\\docs\\pages\\base\\api'
}
```

### Expected behavior 🤔

Running `yarn docs:api --help` should have no changes on any existing files.

Running `yarn docs:api --grep "some regexp"` should also have no changes on any existing files if no file is matched. 

Further more, not sure if the --grep is buggy too in regex search or its just my faulty input, but I would very much like to generate api docs for one component only. 


### Steps to reproduce 🕹

Steps:

1. Run `yarn docs:api --help`
2. Run `yarn docs:api --grep MenuItemUnstyled` or `yarn docs:api --grep menu-item-unstyled`


### Context 🔦

`yarn docs:api` takes really long to run, it would be great if the runtime can be shorten by only generating api docs for one component.

Edit: It takes me 104.43s to run this command :(

### Your environment 🌎

<details>
  <summary>`npx @mui/envinfo`</summary>

```
  System:
    OS: Windows 10 10.0.19043
  Binaries:
    Node: 14.18.1 - C:\Program Files\nodejs\node.EXE        
    Yarn: 1.22.10 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.46)
  npmPackages:
    @emotion/react: ^11.8.2 => 11.8.2 
    @emotion/styled: ^11.8.1 => 11.8.1 
    @mui/base:  5.0.0-alpha.73 
    @mui/codemod:  5.5.1
    @mui/docs:  5.4.4
    @mui/envinfo:  2.0.6
    @mui/icons-material:  5.5.1
    @mui/joy:  5.0.0-alpha.20
    @mui/lab:  5.0.0-alpha.74
    @mui/markdown:  5.0.0
    @mui/material:  5.5.2
    @mui/material-next:  6.0.0-alpha.28
    @mui/private-theming:  5.4.4
    @mui/styled-engine:  5.5.2
    @mui/styled-engine-sc:  5.5.2
    @mui/styles:  5.5.1
    @mui/system:  5.5.2
    @mui/types:  7.1.3
    @mui/utils:  5.4.4
    @mui/x-data-grid:  5.5.1
    @mui/x-data-grid-generator:  5.5.1
    @mui/x-data-grid-pro:  5.5.1
    @mui/x-license-pro:  5.5.1
    @types/react: ^17.0.40 => 17.0.40
    react: ^17.0.2 => 17.0.2
    react-dom: ^17.0.2 => 17.0.2
    styled-components:  5.3.3
    typescript: ^4.6.2 => 4.6.2
```
</details>