Monday, July 17, 2017

Remove or change a "." extension from files

There's quite a lot of convoluted advice out there on how to do this, cut the ".mp3" or other dot something extension from files, using tricky loops and funny shells.  For years I did convoluted things with sed and for loops, but recently I've switched to the simple and versatile /bin/rename command.

My example files:

locnar<117>% touch Snoop1.H264.mkv Snoop2.H264.mkv title00.mkv

locnar<118>% ls
Snoop1.H264.mkv  Snoop2.H264.mkv  title00.mkv

locnar<119>% rename ".mkv" "" *

locnar<120>% ls
Snoop1.H264  Snoop2.H264  title00

Done!



No comments:

Post a Comment