This is a little Node.js program for renaming files in the current working directory. It replaces spaces with hyphens and converts all uppercase characters to lowercase ones.
feminism -lol.png. A previous iteration of this program did not account for this scenario, so it could potentially produce filenames such as
feminism--lol.png which is not horrible, but it is certainly more cumbersome than a file that doesn't contain consecutive hyphens.
Install node. After this, install SpacesJS:
npm install -g spacesjs
Then, simply run the command
spacesjs in the target directory.
- error handling and unique messages (no files renamed, # of files renamed, etc.)
- the ability to anticipate duplicate filenames
- the elimination of additional (potentially detrimental) special characters
- the elimination of hyphens just before the extension (
- prevent file extensions from being modified
Thanks to Tim Spinks for making valuable RegEx suggestions.