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 (
#case
) - to delete characters at a specified position (
#delete
) - to change file extensions (
#extension
) - to insert a text into a specified position (
#insert
) - to remove a text (
#remove
) - to replace a text (
#replace
) - to serialize file names (
#serialize
) - to strip a set of characters off (
#strip
) and - to import lines of a file for insertion (
#import
)
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 .node
using quokka
:
where >
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, quokka
displays characters in color for better 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 quokka
's needs;
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.
Usage Tips
A few useful tips follow below.
Sort files in a natural order
The
-v
option makesquokka
behave in the same way asls -v
when sorting file names; it affects how numbers in file names are handled. Without the option,quokka
performs lexicographic comparison which puts, say,img10
beforeimg2
because1
has a smaller code than2
has. This looks natural to most (if not all) programmers, but ordinary users would like to place10
after2
, which the-v
option does.Control the sorting order
quokka
can accept file names to rename from an external file given through the-f
option. For example, you can edit the file obtained from redirection ofls -t -1
(where-t
for sorting by modification time and-1
for displaying only file names) and give it toquokka
with the-f
option.One-line multiple-command
quokka
is designed to accept multiple commands in a line. For example, you can change files' extensions todocx
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 withreadline
's auto-completion supported bynode.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 \ .
makes
quokka
replace a space with a period (note the space after\
), and#strip> strip \\
does
quokka
strip off all instances of\
. In most cases, the smart auto-completion explained below helps you not to forget escaping spaces.Smart auto-completion
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 atab
key afterHDTV
whenquokka
expects arguments for thereplace
command shows every partial string starting withHDTV
in file names to rename. This helps you to avoid annoying use of your mouse to copy characters from your terminal screen.
How to install
Refer to INSTALL.md
for an installation guide.
Repository
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 as follows:
git clone https://github.com/mycoboco/quokka.git
If you want to contribute to the project, simply fork it and send me pull requests.
Recent commits are:
- chore(package-lock): add package-lock
- chore(package): revert unwanted changes
- chore(package): change min node version to 6.4.0 for later rewrite
- style(quokka): change to western name order
- chore(LICENSE): change to western name order
and more.
Issue tracker
quokka
employed github for its issue tracker. 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.
Open issues are:
- use up-to-date version of wcwidth.js
- refactor code
- unexpected output from auto-completion
- run quokka on a huge list of names
- improve the import command
and more.
License
LICENSE.md
describes the license imposed on users of quokka
.