
The following gif demonstrates the default view (with and without -verbose mode), the built-in alternative views ( long, diff and one-line) and a custom view. Save the above as suffix.js then process all files in the current directory using the above plugin as the replace chain.

Import path from 'path' class Suffix export default Suffix This trivial example appends the text to each file name. Create a module exporting a class which defines a replace method. $ renamer -find "/one/i" -replace "two" ONE.jpgįor more complex renames, or if you just prefer using code, you can write a replace function.

The case-insensitive pattern /one/i matches the input file ONE.jpg, renaming it to two.jpg. Simple example using a regular expression literal.

$ cat files.txt | renamer -find jpeg -replace jpg Same again but with a hand-rolled input of filenames and glob patterns. mtime -20m | renamer -find jpeg -replace jpg This example operates on files modified less than 20 minutes ago. This approach is useful for crafting a specific input list using tools like find. If no filenames or patterns are specified, renamer will look for a newline-separated list of filenames on standard input. $ renamer -find jpeg -replace jpg *Īs above but operates on all files and folders recursively. This trivial example will replace the text jpeg with jpg in all file and directory names in the current directory. MacOS & Linux users should use single quotes.Īs input, renamer takes a list of filenames or glob patterns plus some options describing how you would like the files to be renamed. The examples below use double quotes to suit Windows users. DisclaimerĪlways run this tool with the -dry-run option until you are confident the results look correct. It is flexible and extensible via plugins.

Renamer is a command-line utility to help rename files and folders. Please share feedback and improvement ideas here. Upgraders, please read the release notes.
