Reverser - Foreign filename formatter

by Peter Naulls


Reverser is a foreign filename formatter: it takes filenames from other platforms (e.g. DOS or Unix) and converts them into more RISC OS-friendly filenames.

For example, there might be a Unix file called program.c. When this is moved to RISC OS, it becomes program/c, since RISC OS uses full stops as directory separators. For programs to be compiled using compilers such as gcc, the files need to be placed in c and h directories. This is not so bad if there are a few files, but if there are tens, or even hundreds, of files, doing it manually will take quite a while. Reverser does this all for you.

But Reverser does more than this. It can also intelligently set the RISC OS filetype of files imported from other systems by reading their names. Files brought to RISC OS, for instance, often have essentially useless extensions which are there to indicate their type on a foreign system; for example, picture/gif or index/html. Reverser will remove the extension (and optionally take off trailing "/"s too, left over from file truncations), and then set the filetype depending on the extension that was removed.

Using the application
Running the application from the RISC User menu, or by double-clicking on its icon in a filer window, installs an icon on the icon bar. The icon bar menu has a number of entries, as follows:

Info displays information about the program.

Start leads to a dialogue box containing an icon which can be dragged to a directory, where it will begin converting all the files it finds.

The next five menu options are all toggles; they can be switched on or off and the current state is indicated by a tick or no tick as appropriate.

Remove trailing '/': if this is ticked, files without extensions but with left-over '/'s will have them removed.

Recurse: if this is ticked, Reverser will recurse into any sub-directories it finds.

Treat image as dir: if ticked, any files created with an image filing system (e.g. archives) that Reverser comes across will be dealt with in the same way as directories, so it will go inside the image and process files in it. This is useful if you want to avoid changing files inside archives.

Treat image as file: if ticked, image files are treated as normal files (this option and the one above are not mutually exclusive). This is useful for image files such as Zip archives, when you want to strip the /zip extension.

Logging: this option turns the logging of operations on or off; you will need to open the logging window to see this information, however.

Show log... will open the logging window. This can also be achieved by clicking Adjust on the icon bar icon.

Quit terminates the application.

Configuration
To find out which filetypes it will rename, look in the file !Reverser.Extensions which contains the configuration. Each line of the file specifies an extension, followed by an action. 

The first line contains:
     c       rename  fff  c
which means that files ending in "/c" will have the "/c" removed, and will be placed in a c directory (e.g. program/c becomes c.program). Lastly, the type of the file will be set to &FFF (Text).

Further down you will see:
     jpg     chop   c85
which means that files ending in "/jpg" will have this extension removed (e.g. picture/jpg becomes picture), and the type will be set to &C85 (JPEG).

At the bottom of the file is:
     txt    settype fff
This means that any files ending in "/txt" will have their type set to Text.

If you don't want files to have their type changed, put in "none" for the filetype instead.

Points to note
The file extensions in the configuration file are case-sensitive, so if you are handling upper-case filenames, simply put the uppercase versions in the file too.

A filename will not be renamed if doing so would mean a filename clash.

Please send any comments, suggestions, or general abuse to:
     pnaulls@usa.net


Copyright  RISC User magazine 1998