FilterRename

FilterRename is a CLI tool created to rename a bunch of files at once applying a cascade of self-explainatory options called filters, in order to substitute all the other shell commands (like sed, awk, trim, ... ) and personal shell script to achieve that goal safely and in comfortable manner.

To simplify the whole process through a command line, the full filename is logically organized in targets like:

<path>/<folder>/<name><ext>

Considering the file /home/fabio/Documents/Ruby/filter_rename/Gemfile.lock we have:

  • path: /home/fabio/Documents/Ruby
  • folder: filter_rename
  • name: Gemfile
  • ext: .lock

The chain of filters will be applied to the current target which can be selected using the --select option, the default target is name.

Installation

Install it yourself as:

$ gem install filter_rename

Usage

The main concept about FilterRename is the target manipulation with a chain of filters executed one by one as they appear in the argument's list.

There are three main operations:

  • preview: show the results without make any change (default);
  • dry-run: executes a simulation warning when a conflict is raised;
  • apply: confirm the changes and rename the files unless the destination file exists.

Having the files:

home
  fabio
    Documents
      Photos
        Vacations
          image_portofino_1.jpg
          image_portofino_2.jpg
          image_portofino_3.jpg
          ...

to replace underscores with spaces and capitalize each word let's execute:

filter_rename /home/fabio/Documents/Photos/Vacations/*.jpg --spacify '_' --capitalize --apply

and the result will be:

home
  fabio
    Documents
      Photos
        Vacations
          Image Portofino 1.jpg
          Image Portofino 2.jpg
          Image Portofino 3.jpg
          ...

Get help

Where to start

$ filter_rename --help

More help

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fabio_mux/filter_rename. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.