mv-regex

Move files by applying an regular expression


Keywords
regex
License
MIT
Install
pip install mv-regex==0.3.0

Documentation

CI Conda Version

mv_regex

Move files by applying an regular expression. This allows one to partly rename a batch of files.

Contents

Disclaimer

This library is free to use under the MIT license. Any additions are very much appreciated, in terms of suggested functionality, code, documentation, testimonials, word-of-mouth advertisement, etc. Bug reports or feature requests can be filed on GitHub. As always, the code comes with no guarantee. None of the developers can be held responsible for possible mistakes.

Download: .zip file | .tar.gz file.

(c - MIT) T.W.J. de Geus (Tom) | tom@geus.me | www.geus.me | github.com/tdegeus/mv_regex

Getting mv_regex

Using conda

conda install -c conda-forge mv_regex

Using PyPi

pip install mv_regex

From source

# Download mv_regex
git checkout https://github.com/tdegeus/mv_regex.git
cd mv_regex

# Install
python -m pip install .

Usage

The usage is as follows (see mv_regex --help):

mv_regex
  Rename files using regular expressions. The program will prompt the user for
  confirmation before renaming (unless the "--force" options is used).

Usage:
  mv_regex [options] <search> <replace> <files>...

Arguments:
  <search>        Regular expression to search.
  <replace>       Regular expression to use as replace.
  <files>         List of files on which to do the replacement.

Options:
  -f, --force     Force move, don\'t prompt for user interaction.
  -d, --dirname   Rename directory name (not the file-name).
  -h, --help      Show help.
      --version   Show version.


Example:
  mv_regex "(.*)(_raw.svg)" "\1.svg" *.svg