# Command to run betty on multiple C files

```bash
find /path/to/directory -type f -name "*.c" -exec betty {} \;
```

Here's how it works:

* `find`: The `find` command is used to search for files and directories.
    
* `/path/to/directory`: Replace this with the actual path to the directory where your C files are located.
    
* `-type f`: This option specifies that the command should only search for files, not directories.
    
* `-name "*.c"`: This option specifies that the files should have a `.c` extension.
    
* `-exec betty {} \;`: This tells `find` to execute the command `betty` on each file that matches the criteria. The `{}` is a placeholder that represents the current file being processed. The `\;` is used to indicate the end of the `-exec` command.
    

When you run this command, it will search for all files with a `.c` extension in the specified directory and its subdirectories. For each file found, it will execute the `betty` command with the file as an argument. This allows Betty to analyze each C file separately.

Make sure to replace `/path/to/directory` with the actual path to your directory containing the C files or `.` if in the current directory. This way, you can run the command and have Betty check all the C files in that directory and its subdirectories.

**More on {}**

When you use `-exec` with `find`, the `{}` is replaced by the file name of each file found by the `find` command. For example, if `find` locates a file called `example.c`, the `{}` in the command `-exec betty {} \;` will be replaced by `example.c`, resulting in the command `-exec betty example.c \;`.

In this way, the `-exec` option allows you to pass the found file as an argument to the specified command (`betty` in this case) for each file that matches the search criteria.

Using `{}` allows you to process each file individually within the command executed by `-exec`. It ensures that the command is run separately for each file, allowing you to perform operations or analysis on each file individually.

If you want to limit the search to only the specified directory and not search for files in its subdirectories, you can use the `-maxdepth` option with a value of `1`. Here's an example:

```bash
find /path/to/directory -maxdepth 1 -type f -name "*.c" -exec betty {} \;
```

In this command, `-maxdepth 1` restricts the search to the current directory only, preventing `find` from traversing into subdirectories. It ensures that only the C files in the specified directory are checked by Betty.

**Reserving the finest wine for the last**😄  
As the above command seems nice and works perfectly, what I actually use is:

```bash
betty *.c
```

works ok too.
