Added batch renaming

This commit is contained in:
Samuel Ortion 2021-05-02 09:17:29 +02:00
parent 4410d7fc6d
commit 9f42d4a3c7
2 changed files with 28 additions and 1 deletions

View File

@ -38,4 +38,13 @@ chmod +x expanseR
bash expanseR -o /path/to/your/input/directory -i /path/to/your/output/directory bash expanseR -o /path/to/your/input/directory -i /path/to/your/output/directory
``` ```
You can also use R script in standalone, you will have to specify your folders in the r script. You can also use R script in standalone, you will have to specify your folders in the r script.
## Renaming files
You can rename your files before converting them using the bash script `batch_rename.sh`. You will have to switch the parameter in it such as vigie-chiro prefix
(e.g
```bash
vigie_prefix="Car721035-2021-Pass0-Z2"
```
) and device prefix.

18
batch_rename.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
vigie_prefix="Car721035-2021-Pass0-Z2"
device_prefix="-AudioMoth-247AA5015FDF286B-"
prefix="$vigie_prefix$device_prefix"
echo "Adding $prefix"
extensions=('WAV', 'wav')
n=`ls | wc -l`
i=1
for extension in "${extensions[@]}"
do
for item in `ls *.$extension`
do
echo "($i/$n) Renaming $item"
echo "mv $item $prefix$item"
$(mv "$item" "$prefix$item")
i=$((i+1))
done
done