folders_renamer

Gem Version Dependency Status Code Climate Build Status

Rename/cleanup folder names using the simple rules. For optimal result you may like also like to try my filename_cleaner gem which clean/rename the bad file names.

Features

  • Rename directory recursively from any starting location
  • Replace unwanted characters with value of your choice using --sep-string option (default to . (dot))
  • Following the Semantic Versioning for release schedule
  • Quickly rename bad folder names to good folder names with one command.

TL;DR;

Turn these directories (if your OS allow you to have these names)

some_folder/
├── aa!@#$!01
│   └── bb#@#$@#$@01
├── aa**#$@#$#@$aa
    └── bb$@#$#@$@#bb
        └── cc#$!#$@#cc!!!

into these directories

some_folder/
├── aa_01
│   └── bb_01
├── aa_aa
    └── bb_bb
        └── cc_cc

using command like:

cd ~/path/to/some_folder/

# Perform the dry-run to see what will be changed (no changes)
folders_renamer --sep-string _

# Commit your changes
folders_renamer --sep-string _ --commit

Installation

gem install folders_renamer

Usage/Synopsis

Type the folders_renamer without any options, which will give the following output

Usage:
  folders_renamer -b, --base-dir=BASE_DIR -s, --sep-string=SEP_STRING

Options:
  -b, --base-dir=BASE_DIR        # Starting directory
                                 # Default: . (current directory)
  -s, --sep-string=SEP_STRING    # Separtor string to use
                                 # Default: .
  -c, [--commit], [--no-commit]  # Commit your changes (defalt --no-commit)
  -v, [--version=VERSION]        # Display version number

Cleanup and rename folders

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request