I have a large number of video files i wish to rename and have found both the rename and mmv commands to be great for this. The problem im running into is many of the files begin with the following “[HR] something-something.mkv” I would like to get rid of the [HR] portion completely.
What im gathering is that i need to escape the wildcard characters of the open and closed brackets so that linux will see them as text and not regex. Ive tried using single quote, full quote and backslash to accomplish this but each time i get an error.
The syntax for rename or mmv is as follows to rename files in batch under Linux. Keep backups of files before you do this.
rename.ul command example
rename.ul regex files
rename.ul -n -v '[HR]' '' *.mkv
Remove the -n
and -v
option when it looks safe to proceed.
Linux mmv command for batch rename
mmv -v '\[HR\]*.mkv' "#1.mkv"
See
https://www.cyberciti.biz/tips/renaming-multiple-files-at-a-shell-prompt.html
Thank you so much, this is precisely what i needed. Now i know what im looking for and can start really diving into regex. I think my biggest issue was using the back tick versus the single quote and understanding the difference between the two.