safely batch renaming files/directories via regular expression

Tool:brename: safely batch renaming files/directories via regular expression


Hi all, this post comes from here.

Yes, there are already existed shell commands rename and mv for batch renaming, being very simple to use.
There’s no reason to reinvent the wheels, I agreed.

But one day, I overwrote some important files in a batch renaming operation, which might be family images or raw reads.
You know, removed files can be found in the trash or recovered, but overwritten files are nearly impossible to recover.
Therefore I decided to write a safer batch renaming tool, that could detect overwriting conflicts.

That is the brename: a CLI tool for safely batch renaming files/directories via regular expression.

Here are some main reasons:

  1. Brename supports dry run, by showing which files are going to be renamed and what the new names are. This makes users feel safe.
  2. Besides, it detects potential overwriting conflicts before renaming, which helps avoid overwriting important files like raw FASTQ reads.
  3. At last, it can undo the last operation like the ctrl + z shortcut. This gives users a chance to rescue the wrong move. This is extremely useful when newly renamed contain less information to recover the original names, that is to say, you can’t re-batch-rename.

Extra bonus:

  • Easy to install. Providing statically-linked executable binary files for Linux, Windows, and macOS.
  • Recursively renaming both files and directories.
  • File filtering. Supporting including and excluding files via regular expression.
    No need to run commands like find ./ -name "*.html" -exec CMD.
  • Renaming submatch with corresponding value via key-value file.
  • Renaming via ascending integer.

Similar tools: here’s a benchmark of similar tools, brename ranks 2nd. But safety is the most important point.




updated 20 minutes ago by


written 2 hours ago by


Read more here: Source link