If you have the Perl based rename
(sometimes known as prename
) this is indeed possible. If you understand Regular Expresssions it's even straightforward.
rename -n 's!^(\d+) - (.*)\.(...)$!$2 ($1).$3!' *.avi
What this does is split the source filename into three components. Using your first example these would be
- 1937
- Snow White and the Seven Dwarves
- avi
These are assigned to $1
, $2
, $3
within the rename
command. (These are not bash
variables.) It then puts them back together again in the different order.
When you are happy with the proposed result, change the -n
to -v
, or even remove it entirely.