User Tools

Site Tools


ubuntu:file:rename_multiple_files

This is an old revision of the document!


Ubuntu - File - Rename multiple files

Add an extension

ls
file1 file2 file3

Add the extension “.txt”

for F in $(ls);do mv $F $F.txt;done

Check the result:

ls
file1.rm file2.rm file3.rm

Change the extension

Change the extension from “.txt” to “.mp3”:

for F in $(ls);do mv $F $(echo $F|sed -e 's,\.rm,,').mp3 ;done

Check the result:

ls
file1.mp3 file2.mp3 file3.mp3

Remove the extension

for F in $(ls);do mv $F $(echo $F|sed -e 's,\.mp3,,') ;done

Check the result:

ls
file1 file2 file3
ubuntu/file/rename_multiple_files.1594805433.txt.gz · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki