Hi !

I have many .bam that I want to get their .bai using samtools in the terminal.

I tried the following command :

    samtools index *.bam

However, I did not get any .bai file.

Regards
Samtools index only accepts a single input file, so using a shell metacharacter to specify multiple files will not work. I usually use a shell wrapper to run samtools index on a single file at a time.

```
#!/usr/bin/env bash

# index_all.sh

for INFILE in "$@"
do
   samtools index $INFILE
done
```

Then it is simple to run:

    ./index_all.sh /directory/*.bam