Help

Difference between revisions of "Renaming"

Line 1: Line 1:
== Using the file name's fields ==
+
== Renaming using the file name's fields ==
 
Given files names such as <code>./{codeLang}-{word}-{speaker}-{id}.wav</code> such as <code>./cmn-quan3-Can_Yue-LL12087.wav</code> :
 
Given files names such as <code>./{codeLang}-{word}-{speaker}-{id}.wav</code> such as <code>./cmn-quan3-Can_Yue-LL12087.wav</code> :
  
Line 7: Line 7:
 
   key=$(basename &quot;$file&quot; | cut -d- -f2);    # using &quot;-&quot; as split, select field 2 : &quot;quan3&quot;
 
   key=$(basename &quot;$file&quot; | cut -d- -f2);    # using &quot;-&quot; as split, select field 2 : &quot;quan3&quot;
 
   cp &quot;$file&quot; ./new/cmn-&quot;$key&quot;.wav;          # ./new/cmn-quan3.wav
 
   cp &quot;$file&quot; ./new/cmn-&quot;$key&quot;.wav;          # ./new/cmn-quan3.wav
 +
done</pre>
 +
 +
 +
== Renaming using metadata ==
 +
[to complete]
 +
<pre>mkdir -p ./new                                # create dir
 +
for file in ./cmn-*.wav;
 +
do
 +
 
done</pre>
 
done</pre>

Revision as of 14:21, 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

[to complete]

mkdir -p ./new                                # create dir
for file in ./cmn-*.wav;
do 

done