*****************************************************************************
** Case 2.5 - Filename Changer - by Erik Spåre (Parsec/Phuture 303) 980602 **
** Filematching routines by Anders Vedmar (Axehandle/PC303) **
*****************************************************************************
Very powerful program that lets you rename multiple files. Features:
* Recursive pattern matching (no pattern targets all files in current dir)
* More than 60 recognized extentions.
* ENV:Caseopts file, where you can, for instance, add more extentions.
* 5 Different lower/uppercase modes in many variants.
* 8 extention operations (like add/remove/swap suffix/prefix/extention)
* 11 string manipulation operations (like remove string, add head/tail)
* Can handle *all* letters, not only a-z.
* Direct or indirect renaming mode, won't crash on the ram-disk.
* 100 percent 68000 assembler (d'oh!)
* Freeware
* And more...
An example... Case -l -t -k -apmod Case -sp -w -ue
MOD.OCEAN_LOADER_FIXED ==> mod.ocean_loader_fixed ==> Ocean_Loader_Fixed.MOD
Mod.Green beret ==> mod.green_beret ==> Green_Beret.MOD
mod.CRYSTAL HAMMER ==> mod.crystal_hammer ==> Crystal_Hammer.MOD
DOC1 ==> mod.doc1 ==> Doc1.MOD
Hunters_moon ==> mod.hunters_moon ==> Hunters_Moon.MOD
MOD.SleepWalk ==> mod.sleepwalk ==> Sleepwalk.MOD
MOD.(((nebulos))) ==> mod.nebulos ==> Nebulos.MOD
mod.CREAM OF THE EARTH ==> mod.cream_of_the_earth ==> Cream_Of_The_Earth.MOD
MOD.telephone!!! ==> mod.telephone ==> Telephone.MOD
Here's a list of all the options...
The caseing options
-l All Lowercase
-u All Uppercase
-c Change cases
-w Each new Word uppercase
-f First letter uppercase
-i Ignore suffix and/or prefix when caseing
-I Don't Ignore suffix and/or prefix when caseing
The extention operations
-a Add specified prefix/suffix/extention
-r Remove [specified] extention/s
-C Change [specified] extention to <$>
-s Swap [specified] extention/s
-E Ignore default extensions [only accept specified]
-e Only accept default extentions [and specified]
-L Set new prefix and/or suffix maxlength
-g Give priority to prefix or suffix
The string manipulation operations
-t Transform spaces to underscores
-T Transform underscores to spaces
-d Delete all the spaces [or only specified]
-D Delete specified strings
-C Change string 1 to string 2
-k Keep letters, digits, some more [and specified]
-K Keep A-Z, digits, some more [and specified]
-m Mutilate chars with ASCI values exceeding 128 to 45-127
-a Add head/tail string to filename
-r Remove head/tail string/s from filename
-v Vomit files to PC-format
The remaining options
-D Disable env:caseopts file
-q Be Quiet (only list errors)
-n Neglect the directories
-b Use a buffer when renaming (indirect)
-B Don't use a buffer when renaming (direct)
-S Simulate caseing, don't actually rename anything
-- Stop option parsing
ALL To recurse into subdirs.
SHOWINFO To show a list of all recognized extentions
Changes since version 2.2...
** Fixed flaw: Case -l HIRESDOOM(PPC).PNG resulted in "Can't find file
or path!". This was because any filespecification that contained
wildcards (like the paranthesis in this example) was assumed to be
a searchpattern. Case will now begin by trying to lock the exact
given pattern, and if it exists it won't enter the match mode but
only pass this file (or directory). Thanks to Niels de Koning for
reporting this!
** Found bug in AxeMatch! Case -u dirname ALL would make AxeMatch think
that dirname was a filename! And it would lock the directory dirname
resided in and start to recursively look for files matching dirname.
If dirname was in the root of a partition, all files on that partition
would be examined!
** Case -u dirname ALL will now uppercase everything in dirname as well
as dirname itself. Thanks to Niels de Koning for suggesting this!
** Specified filenames not containing wildcards had to be specified
EXACTLY right. So to uppercase 'fIlE' you had to write Case -u fIlE.
Fixed this.
** Rewrote from scratch the routine that parses the argumentline (except
the part that interpretates the options). Please report any unexpected
behaviour!
** It's now possible to give several filename/pattern specifications,
for instance Case -l file1 file2 file3 dir1/#?.txt would uppercase
the three files file1-3 as well as all files ending with .txt in dir1.
** The env:caseopts file can now contain newlines. They will be converted
to spaces. (And as usual, no spaces are allowed between the comma
separators.)
** Added the option -- which will abort the option parsing. If you
specify a filepattern that begin with - you need to use this
to prevent Case from confusing the filepattern with an option.
** Added the keyword SHOWINFO. It will list all recognized extentions,
internal as well as environmental.
** Decreased the program size with about 1400 bytes by moving some
partly uninitialized data into the BSS section and by letting
AxeMatch access most of its data relative to a5.
Changes since version 2.3...
** Case v2.3 featured a serious bug which would cause deadlocks (in
most cases) when specifying one or more filenames without
wildcards. It worked perfectly during the 24 hours I was bugtesting
it though, so I feel the whole thing is a bit unfair. Thanks to
Niels de Koning & Finn Nielsen for reporting this, and my
apologies to the ones whose Amigas I crashed!
Changes since version 2.4...
** Some very fundamental changes have been made. Basically I have
removed all hardcoded limits (except one), and the option parsing
will now dynamically allocate more memory when it's needed. For
instance, before I had reserved 50 bytes for characters to remove.
If more than 50 were specified, other variables would be
overwritten. Now this isn't the case. Also, wherever it makes sense
it's now possible to specify any amount of parameters. If you wish,
you may specify thousands of extentions to swap/remove, or strings
to change/delete. Here's a list of all the options that have been
enhanced:
-s[<%>] (Swap prefix and/or suffix) now has the syntax
-s<%>[<$>,..] (Swap [specified] extention/s). You can specify the
name of one or more extentions, and then only those will be
swapped. If the match is not case-sensitive, the name will change
to the specified name before it is swapped. If you really dislike
filenames with certain prefixes, for instance mod.#?, and always
want those swapped, you can place -spmod in the env:caseopts file
and whenever Case encounters such a file, it will fix it for you.
-r<%>[<$>] (Remove [specified] extention) now has the syntax
-r<%>[<$>,..] (Remove [specified] ext/s). You can now specify as
many prefixes/suffixes or extentions to remove as you like.
-C<%>[<$>,]<$> (Change [spec] ext to <$>) now has the syntax
-C<%>[<$>,]<$>[,,..]. Any amount of destination extentions can be
specified, but if there's more than one given, there must be a
corresponding source for every destination (naturally).
-r(h|t)<$> (Remove Head or Tail string) now has the syntax
-r(h|t)<$>,.. (Remove Head/Tail string/s). Any number of head or
tail strings can be removed in one operation.
-C"<$>",<$> (Change string 1 to string 2) now has the syntax
-C"<$>",<$>[,,..] (String 1 => string 2) You can now specify any
amount of string substitutions.
The following has only been made dynamic, and are now safe even
for absurd overuse...
-D<$>,.. Delete specified string[s]
-d<c>.. Delete specified char[s]
-e<$>,.. Only accept def exts & spec
-E<$>,.. Only accept specified exts
-k[<c>..] Keep letters, 0-9 "_ ."[&spec]
-K[<c>..] Keep A-Z, 0-9 "_ ." [and spec]
** The amount of error messages has been increased.
** If a given string exceeds 29 characters, an error message will be
displayed.
** `Case -u -n dirname ALL' will no longer uppercase dirname as well,
because of the -n switch (neglect the directories).
** Added the extentions library, device, adf, adz, cfg, cnf, config.
Please send me all extentions that you find missing!
** Since Case 2.3 the -k and -K option has produced a syntax error
when including " or '. Fixed this.
** The -u/l/f/w/c options will now change the priority if the argument
is p or s.
** Fixed the problem with the -L option, when specifying e, p or s.
This hasn't worked since I renamed it in version 2.1.
** Some routines would change the extention priority when e (or
nothing, implying e) was given as a target.
** The -v option (vomit) would CLEAR the remove suffixes/prefixes
flags, if this wasn't specified after the -v option, thus
overriding any previous specification of -r<%>.
** The -f option (uppercase first character, lowercase the rest)
would, if the first character was not possible to uppercase,
continue trying until it found a character that it could uppercase.
For instance, since the first characters in 68060.library are
digits, Case would rename it to 68060.Library. Fixed this. Thanks
to Niels de Koning for reporting!
Remember:
"This should be in every man's c-directory"
/Axehandle.
|