MAINSAIL Utilities User's Guide, Chapter 30

previous   next   top   contents   index   framed top   this page unframed


30. RNMFIL, File Renamer

Command line syntax: rnmfil {fileName {newFileName}}*

The MODULE RNMFIL allows you to rename one or more files from within MAINSAIL. The same device MODULE must be used for both the old and new files; i.e., renaming files across device MODULEs is not supported.

RNMFIL accepts pairs of file names on the command line; each file named fileName is renamed to newFileName, if possible. If no arguments are given, RNMFIL prompts for the name of each file to be renamed. Example 30–1 shows how to use RNMFIL to rename files from within MAINSAIL. The file foo is renamed to be bar, and the file baz is renamed to be newbaz.

Example 30–1. RNMFIL Example
MAINSAIL (R) Version 16.20.<release> (? for help)
Revision: <date>
Copyright (c) 1984-1998 by XIDAK, Inc., Point Arena,
 California, USA.

*
rnmfil<eol>
Next file to be renamed (just eol to stop): foo<eol>
New file namebar<eol>
Next file to be renamed (just eol to stop): baz<eol>
New file namenewbaz<eol>
Next file to be renamed (just eol to stop): <eol>
*

                
Alternatively:

*
rnmfil foo bar baz newbaz<eol>
*

If an error occurs when trying to rename the file specified, RNMFIL issues an error message and prompts for an error response. If <eol> is typed in response to the Error Response prompt, you are given a chance to respecify the file names. Example 30–2 shows this interaction. The example assumes that the file foo does not exist and that the file baz exists and can be opened. An error message is given saying that the file foo could not be found. When respecifying the file names, typing <eol> causes the previously specified name to be used (<eol> in response to the New file name (just eol for bar) prompt causes the file baz to be renamed to be bar).

Example 30–2. RNMFIL Example with a Rename Error
MAINSAIL (R) Version 16.20.<release> (? for help)
Revision: <date>
Copyright (c) 1984-1998 by XIDAK, Inc., Point Arena,
 California, USA.

*
rnmfil<eol>
Next file to be renamed (just eol to stop): foo<eol>
New file namebar<eol>

File not found

ERROR$renamecould not find old file foo => bar
Error Response<eol>
Want to specify new names (Yes or No): y<eol>
File to rename (just eol for foo): baz<eol>
New name (just eol for bar): <eol>
Next file to be renamed (just eol to stop): <eol>
*


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Utilities User's Guide, Chapter 30