An Interactive File Renamer
Want to see pretty graphs? Log in now!
npm install quokka
|10||downloads in the last week|
|19||downloads in the last month|
|Last Published By|
|Version||0.0.7 last updated 4 months ago|
|Keywords||rename, file rename, batch renamer, interactive renamer, terminal|
|Dependencies||colors, optimist, string, underscore, wcwidth.js|
quokka: An Interactive File Renamer
quokka is an interactive file renamer, which helps to rename multiple files
in a systematic manner.
It provides a set of rules:
- to change letter case (
- to delete characters at a specified position (
- to change file extensions (
- to insert a text into a specified position (
- to remove a text (
- to replace a text (
- to serialize file names (
- to strip a set of characters off (
- to import lines of a file for insertion (
with options for fine control. You can combine these rules as you want by
adding them into the rule chain. Editing each rule and the rule chain is
performed interactively as you do in a shell prompt. The following, for
example, shows how to rename files' extensions to
> #extension entering '#extension' #extension> change to node file extensions will change to 'node' #extension> preview current rule being edited ------------------------- change extensions to 'node' not using limit files will be renamed as follows when you type 'done' and 'rename' ------------------------------------------------------------------ ./alphanum.js | ./alphanum.node ./global.js | ./global.node ./mycolors.js | ./mycolors.node ./validator.js | ./validator.node #extension> done files will be renamed as follows when you type 'rename' ------------------------------------------------------- ./alphanum.js | ./alphanum.node ./global.js | ./global.node ./mycolors.js | ./mycolors.node ./validator.js | ./validator.node > rename files are being renamed ----------------------- ./alphanum.js | ./alphanum.node [ok] ./global.js | ./global.node [ok] ./mycolors.js | ./mycolors.node [ok] ./validator.js | ./validator.node [ok] 4 files successfully renamed you need to 'reset' file list and rules after 'rename' > exit
> indicates a
quokka's prompt and
#extension before it shows the
user is editing the
#extension rule. Typing
help lists what commands
quokka accepts in general and in a specific rule mode. (In fact,
displays characters in color for readability; see the screenshot above.)
Even if its source code contains some stuff related to MS Windows, it currently supports and is tested only for UNIX-like environments. For now, nothing is guaranteed for MS Windows.
INSTALL.md explains how to build and install the program. For the copyright
issues, see the accompanying
Among libraries used,
alphanum.js has been modified to meet
it has been modified to behave in a more similar way to
ls -v and to return
the sorted array instead of nothing. If you need to replace that module with,
say, a updated one, it is necessary to apply these changes properly.
A few useful tips follow below.
Sort files in a natural order
quokkabehave in the same way as
ls -vwhen sorting file names; it affects how numbers in file names are handled. Without the option,
quokkaperforms lexicographic comparison which puts, say,
1has a smaller code than
2has. This looks natural to most (if not all) programmers, but ordinary users would like to place
2, which the
Control the sorting order
quokkacan accept file names to rename from an external file given through the
-foption. For example, you can edit the file obtained from redirection of
ls -t -1(where
-tfor sorting by modification time and
-1for displaying only file names) and give it to
quokkais designed to accept multiple commands in a line. For example, you can change files' extensions to
docxby this one-line input:
> #extension change to docx done rename
instead of these multiple lines:
> #extension #extension> change to docx #extension> done > rename
The thing is that the newline character does not differ from other white-spaces in separating commands.
Names with embedded spaces
The earlier versions of
quokkaused quotation for spaces embedded in file names. This approach made troubles with
readline's auto-completion supported by
node.js, and had me choose to escape spaces with a leading backslash. Since the backslash character is now used for escaping spaces, it is necessary to escape backslashes themselves. For example,
#replace> replace \ .
quokkareplace a space with a period (note the space after
#strip> strip \\
quokkastrip off all instances of
\. In most cases, the smart auto-completion explained below helps you not to forget escaping spaces.
The recent versions of
quokkasupport the smart auto-completion that is smart in the sense that it is aware of the input context and suggests appropriate words. For example, pressing a
quokkaexpects arguments for the
replacecommand shows every partial string starting with
HDTVin file names to rename. This helps you to avoid annoying use of your mouse to copy characters from your terminal screen.
If you have a question or suggestion, do not hesitate to contact me via email (woong.jun at gmail.com) or web (http://code.woong.org/).