Help
Difference between revisions of "Renaming"
Line 11: | Line 11: | ||
== Renaming using metadata == | == Renaming using metadata == | ||
− | + | ;Dependencies | |
+ | <pre>sudo apt-get install lame avconv | ||
+ | avconv -i ./cmn-zhuo.wav 2>&1 # print out metadata of $file, for some formats only | ||
+ | </pre> | ||
+ | |||
+ | ;Renaming | ||
<pre>mkdir -p ./new # create dir | <pre>mkdir -p ./new # create dir | ||
for file in ./cmn-*.wav; | for file in ./cmn-*.wav; | ||
Line 18: | Line 23: | ||
# new name | # new name | ||
done</pre> | done</pre> | ||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 14:27, 21 May 2018
Renaming using the file name's fields
Given files names such as ./{codeLang}-{word}-{speaker}-{id}.wav
such as ./cmn-quan3-Can_Yue-LL12087.wav
:
mkdir -p ./new # create dir for file in ./cmn-*.wav; do key=$(basename "$file" | cut -d- -f2); # using "-" as split, select field 2 : "quan3" cp "$file" ./new/cmn-"$key".wav; # ./new/cmn-quan3.wav done
Renaming using metadata
- Dependencies
sudo apt-get install lame avconv avconv -i ./cmn-zhuo.wav 2>&1 # print out metadata of $file, for some formats only
- Renaming
mkdir -p ./new # create dir for file in ./cmn-*.wav; do key=$(avconv -i "$file" 2>&1 | sed -ne 's/.*SWAC_TEXT *: //p') # print metadata, assign SWAC_TEXT's value to variable. # new name done