Files in directory :
$ ls | sort -n
1.mp4
2 .mp4
3 .mp4
4 .mp4
5 .mp4
6 .mp4
7 .mp4
8 .mp4
9 .mp4
10 .mp4
A list of file names in a playlist file :
$ cat playlist.m3u8
1- Introduction-OxIDLw0M-m0.mp4
2 - How React Works-pKYiKbf7sP0.mp4
3 - React Setup (with CDN)-SAX6RMEFVM4.mp4
4 - React Components-Fis_Q3rkgtM.mp4
5 - State-yuN4EMjR4K4.mp4
6 - React Dev Tools--XQ2zCdxw0I.mp4
7 - DOM Events--ZB8I2PmiOw.mp4
8 - Changing State (and 'this')-XJzDF9bj368.mp4
9 - Intro to Forms-BVbdZ1133JU.mp4
10 - Create React App-5QwNCX3UbXc.mp4
The file names start with numbers. How do I rename the files in directory by names listed in playlist file with their corresponding numbers so the outcome would be :
$ ls | sort -n
1- Introduction-OxIDLw0M-m0.mp4
2 - How React Works-pKYiKbf7sP0.mp4
3 - React Setup (with CDN)-SAX6RMEFVM4.mp4
4 - React Components-Fis_Q3rkgtM.mp4
5 - State-yuN4EMjR4K4.mp4
6 - React Dev Tools--XQ2zCdxw0I.mp4
7 - DOM Events--ZB8I2PmiOw.mp4
8 - Changing State (and 'this')-XJzDF9bj368.mp4
9 - Intro to Forms-BVbdZ1133JU.mp4
10 - Create React App-5QwNCX3UbXc.mp4
mv
orrename
and for loop in shell script for example. – Arkadiusz Drabczyk Feb 24 '20 at 14:03paste
? – Arkadiusz Drabczyk Feb 24 '20 at 14:052 .mp4
or2.mp4
? – Arkadiusz Drabczyk Feb 24 '20 at 14:06