Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Aivean/renamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Renamer

Simple yet powerful file rename script. Rename batch of files as simple text lines.

This script doesn't provide much functionality by itself, but instead it leverages the power of your favorite text editor or IDE.

Demo worth a thousand words

Requirements

Usage

  • Download the latest release
  • execute java -jar path_to_renamer.jar --help to see the usage:
    ~ $ renamer --help
    Usage: renamer [options] [glob]
    
      -o, --order <value>  File ordering (default is by name). Use one of these values (or prefix):
         * name (default)
         * extention
         * modification time
         * size
    
      --reverse            Reverse ordering
      -a, --arrow <value>  Arrow symbol. Default is '->'
      --help               print this usage text
      glob                 optional glob pattern (enclose in quotes)
    
  • execute java -jar path_to_renamer.jar (without any args) to rename files in current directory
  • follow the interactive instructions

Consider creating bash alias for the renamer. It's more convenient to type renamer instead of java -jar ....

Advanced usage

Script supports several parameters:

  • --order allows to override sort order of the files

  • --reverse reverse the selected file ordering (see --order)

  • --arrow use alternative arrow symbol (make output look more fancy)

  • trailing argument is a file filter in glob format. Example:

    java -jar renamer.jar "**/*.png"
    

    Two things to keep in mind when providing glob parameter:

    • glob parameter must be enclosed in quotes ("**"), as otherwise bash supplies actual file names as an argument instead of the pattern
    • search becomes recursive (from current directory) and pattern is tested against the absolute file path, so in order to match anything pattern must start from the wildcard (**/*.ext)

Development

  • install sbt
  • in project directory:
    • sbt compile — to compile project
    • sbt assembly — to create a fat jar

Credit

  • Scala ❤️
  • Scopt — simple scala command line options parsing
  • Better files — Simple, safe and intuitive Scala I/O