HOME  |  GIT Overview  |  Script-Archive: (docs) : (wiki) : (git)  |  ...

Peter's Script-Archive - Mass-Renaming Files


This toolbox compartment offers two tools for mass renaming files, both of which also offer UNDO-logging, link target editing and more.

One allows for way too much configurability/perl evals with an optional interactive mode that acts on each file independently (myrename), while the other shows all files at once in your favorite editor (emv). If the task is repetitive, use myrename; if you need to do it all the time, pre-define a small perl scrap in myrename.cfg and just say myrename <NAME-OF-SCRAP> FILES. If you want to see all the files at once and want to think about their names while editing and changing whole groups of files, use emv instead (when using vim, do read up on g//p, sort, regex and visual blocks; emv thrives and wilts with the capability of the editor invoked).

For an interesting German article on the gestation of Torsten Scheck's original emv shell version (starting indeed with the initial pre-emv recipe of ls ...; paste -d ...; source ...), see his Pro-Linux article from 2006. (Google's quite readable attempt at machine translation). The perl version should be strictly a superset of the 1.95 shell version, so all of Torsten's points are still valid, with the sole exception that during editing you need to allow for the line number column, thus increasing emv's dependency on a suitably powerful editor. Torsten also includes an overview of other options including native shell, perl's prename and mmv. The only additions I can think of would be bash/ksh93 variable content editing ${VAR##...} (bash: use shopt -s extglob to turn on regex support in globs) and on the GUI side say gprename or krename, which demonstrate that a properly designed application can offer a clean GUI without succumbing to the usual GUI trap of severely crippling the functionality. But even apps like gprename do profit from a user spending a bit of time to learn her shell globs and regular expressions.

See also GREP.xchange, which is somewhat similar:

Commands

Git View of this section / Download

Other commands:


HOME  |  GIT Overview  |  Script-Archive: (docs) : (wiki) : (git)  |  ...

jakobi(at)acm.org, 2009-07 - 2012-03