quokka is an interactive file renamer, which helps to rename multiple files
in a systematic manner.
It provides a set of rules:
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.)
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.
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
-v option makes
quokka behave in the same way as
ls -v when
sorting file names; it affects how numbers in file names are handled. Without
quokka performs lexicographic comparison which puts, say,
1 has a smaller code than
2 has. This looks
natural to most (if not all) programmers, but ordinary users would like to
2, which the
-v option does.
Control the sorting order
quokka can accept file names to rename from an external file given through
-f option. For example, you can edit the file obtained from redirection
ls -t -1 (where
-t for sorting by modification time and
displaying only file names) and give it to
quokka with the
quokka is designed to accept multiple commands in a line. For example, you
can change files' extensions to
docx by 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
quokka used quotation for spaces embedded in file
names. This approach made troubles with
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 \ .
quokka replace a space with a period (note the space after
#strip> strip \\
quokka strip off all instances of
\. In most cases, the smart
auto-completion explained below helps you not to forget escaping spaces.
The recent versions of
quokka support 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
tab key after
quokka expects arguments for the
replace command shows every partial
string starting with
HDTV in file names to rename. This helps you to
avoid annoying use of your mouse to copy characters from your terminal
This package does not provide an automated way to build or install the program
quokka runs on
node.js on your system,
npm install quokka
brings and installs
quokka with its all depending packages.
The simplest way to use
quokka is just to run it using
node.js as follows:
$ node quokka.js <files-to-rename>
$ indicates a user prompt.
In a UNIX-like environment, it would be more convenient to put into a
/usr/local/bin a shell script that runs
#!/bin/sh node /path/to/quokka/quokka.js -v "$@"
or to set an alias for
alias quokka='node /path/to/quokka/quokka.js -v'
-v option tells
quokka to sort numbers in file names naturally.
quokka had used Mercurial (which is also
and commonly called
hg) as its repository, and moved into Git
to be published on Github. You can browse the repository through the
web, or clone it by running Git as follows if you have installed Git on
git clone https://github.com/mycoboco/quokka.git
If you want to contribute to the project, simply fork it and send me pull requests.
quokka had hired Trac for its issue tracker,
and moved to Github for easier access. If you'd like to file a bug or
ask a question, do not hesitate to post a new issue; a self-describing title or a
short text to deliver your idea would be enough. Even if issues I have posted are all
written in English, nothing keeps you from posting in Korean.
For your convenience, the package for
quokka contains non-npm modules it
depends on to run, and their licenses are specified in their installation
directories. For example,
alphanum.js says in its heading comment that it is
licensed under the LGPL; there are
small changes to
alphanum.js, which the introduction
elaborates on. The following license does not apply to those modules.
Copyright (C) 2012 by Jun Woong.
This package is an interactive file renamer implementation by Jun Woong.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
I'd be glad to hear your opinion. Do not hesitate to contact me via email (woong.jun at gmail.com).