Skip to content

A powered-up version of Microsoft's "PowerRename" bulk rename tool, part of the "PowerToys" suite

License

Notifications You must be signed in to change notification settings

DiegoBM/power-rename-ext

Repository files navigation

PowerRenameExt

PowerRenameExt is a cross-platform bulk renaming tool conceived as a powered-up version of Microsoft's PowerRename tool (part of the PowerToys suite), with extra added functionality such as the ability to use functions in order to compute the replacements, which in turn enables the user to process more advanced file renaming and indexing operations.

It features:

  • Regular expression replacement.
  • Match one or all occurrences.
  • Case sensitive search.
  • Apply to filenames, extensions or both.
  • Include/Exclude files, folders and subfolders.
  • Use a function to process a replacement for a given search term.
  • Use a function to process a replacement instead of a search term (global function).
  • Dark/Light theme as stablished in the system settings.

Standard replacement

standard_replacement

Regular expression replacement

regular_Expressions

Replacement function

replacement_function the replacement function will receive the same arguments that you should expect from the JavaScript replace function

Global function

global_function the global function will receive the entire entry name as search (including the extension for files), and will use whatever the function returns as replacement

Both function features will receive a set of extra information through the this object. In particular they will receive:

  • globalIndex: The global index of the current item across the entire processing.
  • fileInFolderIndex: The index of the current entry within its containing folder, as found when the directory was read. Note that only files will receive this type of index.
  • isFolder: Indicates whether the current entry is a folder or not.
  • stats: The Stats object of the current entry as returned by the node.js stat function. For example, you can use this.stats.birthtime.

How to use

Once built and packaged, the final executable will accept a list of space-separated arguments that will use as the source paths to recursively process. These source paths can be either files or folders:

 .\PowerRenameExt.exe "E:\test\test1.txt" "E:\test\test2.js" "E:\test\test3.pdf" "E:\test\test_folder"

On Windows, if you install from the installer available in the releases section, then you can also open one file or folder (recursively) using the file explorer's context menu integration, by right-clicking on the desired file or folder and choosing the option "Open with PowerRenameExt".

Note than on Windows 11, you'll need to select the "Show more options" option first.

Setup for development

Clone the repo and install dependencies:

git clone https://github.com/DiegoBM/power-rename-ext.git

cd power-rename-ext

npm install

Starting Development

Create a new .env file with the TESTPATHS entry (read below)

Start the app in the dev environment:

npm start

How to test in development

During development, the interface will try to load and process any paths included in an environment variable named TESTPATHS defined in a .env file at the root folder of the project.

These paths need to be defined in a comma-separated list:

# .env

TESTPATHS=E:\test\test1.txt,E:\test\test2.js,E:\test\test3.pdf,E:\test\test_folder

Packaging for Production

To package apps for the local platform:

npm run package

Maintainer

Diego de Blas Mateo

Notes

Being an Electron application, and using only platform agnostic file-system operations, the final result should work accross all desktop platforms, but please bear in mind that it has only been tested in Windows and Linux, since I don't own a Mac to test on.

Latest React dev tools extension is not supported by the current version of electron at the time of release. In order to downgrade the extension please follow the instructions at this link.

Credits

Created using the fantastic Electron React Boilerplate as base.

License

MIT © PowerRenameExt