Rename Files and Add Bracket to Years of Movies

Below is an example of how this could be solved with links to regex101.com to try them out

This will replace the periods

Match = '/[\s\.]/m';
Replace = ' '

https://regex101.com/r/Hn01d7/1/

This will put brackets around our year

Match = /(.)(\d\d\d\d)/gm;
Replace = `\1(\2)`;

https://regex101.com/r/mRX88I/1

I am currently not on a *nix machine and so am not able to try this out.

But to do this in CLI,

use rnm like this

rnm -y -rs '[Regex]' [FileLocation]

where -y will confirm all changes without asking -rs replace string command ‘[Regex]’ is your regex statement ‘[FileLocation] is where all your directories are. use ./* for all

eg: rnm -y -rs ''s/(.+ )(\d\d\d\d)/\1(\2)/'' ./*

use link below as reference;

https://neurobin.org/docs/unix/rnm/bulk-rename-in-linux#41-search-for-files-with-regex-and-rename

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top