https://github.com/roppa/renamer
Rename files in a directory based on titles in an array
https://github.com/roppa/renamer
filesystem renames
Last synced: about 1 year ago
JSON representation
Rename files in a directory based on titles in an array
- Host: GitHub
- URL: https://github.com/roppa/renamer
- Owner: roppa
- Created: 2017-05-06T15:41:23.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-06T17:31:48.000Z (about 9 years ago)
- Last Synced: 2025-02-14T18:36:28.915Z (over 1 year ago)
- Topics: filesystem, renames
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Renamer
Problem:
1. There is a bunch of badly named files
2. We have a JSON array, with a title for each file, in order of the files in #1
3. The title needs to be formatted as such to make it suitable for use over http
4. The files need to be renamed, using the formatted title from #3
## rename(path, array)
Takes a directory path and an array of new file names and renames those files to those specified in the array.
If number of files in directory do not match the length of array, an error is thrown.
## formatTitle(string)
Takes a string and converts it to lowercase, replaces any non-alphanumeric to a hyphen.
Example:
'The Declaration of Independence 1817–1819' becomes 'the-declaration-of-independence-1817-1819'.