massren は go でできたコマンドラインツールです。コンソールで massren を実行すると、エディタを開き、カレントディレクトリのファイル名やディレクトリ名を表示し、編集することでファイル名やディレクトリ名を変更したり削除できます。エディタは指定可能です。オプションでファイル名、ディレクトリ名を指定することもできます。

ファイルやディレクトリを対象に、一括で名前を変更、削除する場面は少なくありません。その時には手作業やシェルスクリプト、バッチコマンドが活躍していると思います。massren はこのような場面で選択肢の一つになる便利なソフトウェアです。

massren の主な特徴

1) マルチプラットフォーム

Linux、Mac OSX、Windows で利用できます。

2) お好みのエディタで操作できます。

好きなエディタを指定できます。vimを指定する場合は次の通りです。

massren --config editor vim

3) コマンドラインからファイル名、ディレクトリ名を指定

指定しなければ、カレントディレクトリ内の全てのファイルとディレクトリを処理の対象とします。

massren

ワイルドカードを利用できます。ディレクトリ名を指定できます。次は Windows での例となります。

massren z:\*.txt

4) ファイル名、ディレクトリ名の変更や削除

エディタでファイル名を変更します。ファイル、ディレクトリの削除は、行の始めに // を追記します。次は sample01.txt を削除する例となります。

//sample01.txt
sample02.txt

エディタで編集したファイルを保存し終了します。これで操作は完了です。

5) さまざまな設定とオプション

例えば、Windowsでごみ箱を利用せずにファイルを削除したい場合、次の設定を行います。

massren --config use_trash 0

ディレクトリを処理の対象とする場合は、次の設定を行います。

massren --config include_directories 1

上記を含め、設定可能な対象は次の通りです。

Possible key/values:

  editor:              The editor to use when editing the list of files.
                       Default: auto-detected.

  use_trash:           Whether files should be moved to the trash/recycle bin
                       after deletion. Possible values: 0 or 1. Default: 1.

  include_directories: Whether to include the directories in the file buffer.
                       Possible values: 0 or 1. Default: 1.

  include_header:      Whether to show the header in the file buffer. Possible
                       values: 0 or 1. Default: 1.

使用可能なオプションは次の通りです。

Application Options:
  -n, --dry-run  Don't rename anything but show the operation that would have
                 been performed.
  -v, --verbose  Enable verbose output.
  -c, --config   Set or list configuration values. For more info, type:
                 massren --config --help
  -u, --undo     Undo a rename operation. Currently delete operations cannot be
                 undone (though files can be recovered from the trash in OSX
                 and Windows). eg. massren --undo [path]
  -V, --version  Displays version information.

Help Options:
  -h, --help     Show this help message

massren のインストール

ソース・コードをダウンロードしてコンパイルする方法と、リリース版をダウンロードして利用する方法があります。後者の場合、go の実行環境は不要です。

仕事以外、家庭での利用にも便利です。デジタルカメラで撮影して、その写真を整理する場面で大変便利です。運動会、文化祭などこれから多くのイベントがあると思います。massren が活躍する場面が多くなるのではないでしょうか。

massren は Go 製、MIT License のオープンソース・ソフトウェアです。

massren - easily rename multiple files using your text editor source code binary