home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
filemanager
/
rename_1
/
!Rename
/
!Help
< prev
next >
Wrap
Text File
|
1997-06-03
|
9KB
|
239 lines
!Rename V1.09
~~~~~~~~~~~~~
Purpose
~~~~~~~
!Rename is a program intended to rename files in an 'intelligent' way.
It is started in the normal way by double-clicking on the icon, after
which it installs itself on the iconbar.
How to use it
~~~~~~~~~~~~~
To rename a group of files, drag them to the iconbar icon. This will
open a dialog box.
The dialog box is split into four areas, as below:
Files The files area contains a list of the names of files that
are possible candidates for renaming.
Prototype The prototype area contains a text box, and a number of
buttons which can substitute for keys. The buttons also
act as an aide memoire for the wildcard characters. These
wildcards act in a similar way to the wildcards in the
!Edit Find/Replace dialog box when 'wildcarded expressions'
is selected:
. : Matches any character
@ : Matches any alphabetic character
? : Matches any alphanumeric character
# : Matches any digit
[] : Matches any one of the characters inclosed in
the brackets.
^ : Matches one or more of the following characters
or wildcards.
* : Matches zero or more of the following characters
or wildcards.
%<c> : Literal <c>, to allow the inclusion of the wildcards
in filenames (in practice, this only applies to
'[' & ']' characters).
In addition, there is a button to enable case-sensitive
filename matching.
Rename To This area contains a text box, another aide memoire button,
and a pair of number entry boxes. The field character '&'
must be followed by a field number, and substitutes for one
of the wildcard fields in the prototype section (the first
field is the field number one).
Field number zero is used to give sequential numerical fields
in the resulting filename. The 'Digits' box states how many
digits are used in the index number, and the 'Sequence' box
gives the number of the first number generated.
!Rename also provides a number of special non-numeric field
specifiers. Currently, these are:
&N : The complete filename
&D : A best-guess DOS extension for the file type
&U : A best-guess Unix extension for the file type.
(See the examples section for a sample use of one of these).
There is also a pop-up menu to force a change of case - This
may be set to one of:
As Is : Keep the same case as the original file
Upper : Force all letters to upper case
Lower : Force all letters to lower case
Initial Caps : The first letter in each "word" becomes a
capital letter, and all other letters are
lower case. In this context, a "word" is
any sequence of alphanumerics.
Finally, there is an option button to instruct Rename to 'guess'
the RISCOS filetype of the file from its extension (or what the
extension was before any renaming occurs). Files created with
Windows 95 can confuse the filetyping mechanism of DOSFS; this
feature of !Rename will help to overcome this problem.
Buttons The buttons area consists of Cancel and Rename buttons, plus
the Pattern popup menu button.
The cancel and rename buttons perform the obvious tasks;
the Pattern popup menu is used to fill in the various dialog
box controls with values from either a named pattern, or the
immediately previous pattern.
By default, this history is 10 commands long; this can be
overridden by the OS variable Rename$NumPattern:
SetEval Rename$NumPattern 20
Examples
~~~~~~~~
To remove DOS extensions from RISCOS filenames (eg to rename 'tharg/jpg' to
'tharg'):
Prototype : ^./^.
Rename To : &1
To rename all the files in a directory beginning with 'A' or 'a' to A_nnnn,
where nnnn is a four-digit number starting at number 50:
Prototype : [Aa]^.
Rename To : &1_&0
Sequence : 50
Digits : 4
Alternatively, one could use a prototype of "a^." with case sensitivity
disabled.
To add a DOS extension to a RISCOS filename (eg to rename a group of mixed
JPEGs, GIFs etc):
Prototype : ^.
Rename To : &1/&D
To shift files into sub-directories according to DOS or Unix filetype extension
(eg tharg/c becomes file tharg in subdirectory c):
Prototype : ^./^.
Rename To : &2.&1
Patterns
~~~~~~~~
It is possible to save the immediately preceeding rename parameters by the use
of named patterns. The 'Patterns' iconbar menu option leads to the following
options:
Save : This menu item leads to a small dialog box where the current pattern
can be given a name (up to 24 characters long). Enter the name by
which you wish to remember the pattern, and click the 'OK' button.
If the maximum number of patterns have already been saved, this item
is greyed.
Delete : This menu item leads to a list of currently-known patterns; selecting
one of these items will delete the saved pattern.
If there are no patterns to delete, this item is greyed.
Maximum filename length
~~~~~~~~~~~~~~~~~~~~~~~
The maximum 10-character filename imposed by ADFS can be accidentally
exceeded with the pattern renaming provided by !Rename. To prevent this
from happening, the iconbar menu for !Rename has the "Truncate" option,
which leads to a small dialog box where the maximum allowable filename
length can be set. Clicking on the Truncate option itself will toggle
whether filename truncation is active or not (for simplicity, !Rename has
a maximum internal filename length of 100 characters, which should be
enough for most purposes!).
The initial setting of the Truncate option can be set in the !Run file,
using:
SetEval Rename$MaxNameLength <n>
where n is the default maximum length. If n is negative, !Rename will use
the absolute value of n, but with truncation initially disabled. If n is
zero or unset, it is treated as -10.
TypeMap file
~~~~~~~~~~~~
There does not seem to be a particularly neat way of deducing a DOS or Unix
extension from a RISCOS filetype; specifically, there is no SWI to look up
the current DOSMap settings. !Rename therefore needs to be provided with a
set of mappings to use for the &D and &U special fields. These mappings are
stored in the file "TypeMap" in the !Rename application directory, and can be
editted by the user as and when additional mappings need to be represented.
The format of this file is very simple: Each mapping is on a new line, and
consists of the RISCOS filetype value in hex (000-FFF), the DOS extension, and
the Unix extension. Mappings can be given in any order, and the hex value may
be upper or lower case.
Known Bugs
~~~~~~~~~~
1) Very occasionally during the development of !Rename, dragging a number
of files to the iconbar icon would cause !Rename to crash. I /think/
I've fixed it, but it was such an unpredictable occurrence it is
impossible to test.
History
~~~~~~~
Version Changes
~~~~~~~ ~~~~~~~
1.00 Initial distribution version
1.01 Added case override for the output file;
added maximum filename length;
Special fields &N, &D and &U implemented.
1.02 Fixed bug with RISCOS filetypes with no
known Unix/DOS equivalent.
Fixed maximum filename length bug.
1.03 Can now rename files into sub-directories;
"Previous" button turned into a popup menu,
so many named patterns can be remembered.
1.04 Fixed bug with pre-RiscPC error handling
1.05 Minor alteration to case override definition
for 'Initial Capital'.
1.06 Added RISCOS filetyping button to alleviate DOSFS
problem with Windows 95 files.
1.07 "Comma" bug fixed.
Can now open dialog box with an click on the iconbar icon,
and add files to the list (but all files must be in same
directory).
1.08 WimpSlot increase to 64K so squeezed !RunImage decompresses OK.
1.09 Now distributed with !RunImage /not/ squeezed, and WimpSlot
back at 54K
Disclaimer
~~~~~~~~~~
This software is provided 'as is', and 1 accept no responsibility for any loss
caused as a result of its use.
That notwithstanding, I am perfectly happy to receive bug reports via email (or
snail mail, come to that). Please state:
a) the version in use
b) a description of the bug
c) a list of filenames dragged to the iconbar
d) the 'Prototype' & 'Rename To' fields, whether case sensitivity was enabled,
and any other constraints (Maximum filename length, case overrides, etc)
____________
Nick Roberts
tigger@argonet.co.uk
http://www.argonet.co.uk/users/tigger/