changeNomACM.sh

script_renommage_impressions - François-Marie BILLARD, 03/18/2020 05:40 pm

Download (472 Bytes)

 
1
IFSori=$IFS
2
IFS=','
3
4
cd ./copies_imprimées/
5
cp ../liste.csv ./
6
7
while read field1 field2 field3 fiedl4; do
8
  
9
   if [ ${#field3} -eq 1 ]
10
   then
11
	string3="000"
12
   fi 
13
   if [ ${#field3} -eq 2 ]
14
   then
15
	string3="00"
16
	fi  
17
   field3=$string3$field3
18
   nomFichier=$(ls  | grep "$field3")
19
   nouveauNom="SUJET_"$field1"_"$field2".pdf"
20
   mv "${nomFichier}" "${nouveauNom}"
21
   
22
   
23
    
24
done < liste.csv
25
26
# penser a restaurer l&#039;ancienne valeur de l&#039;IFS
27
IFS=$IFSori