<!-- PDF page 184 -->

```
COPY "c:/test.bas" TO "d:/"
ERASE "c:/test.bas"
```

As you probably have already figured out, moving and renaming files is basically the same procedure and since we have to write an entire filename in both source and destination we can change it at the same time!

```
MOVE "hello1.bas" TO "c:/bak/hello.bak"
```

both *moves* locations and *renames* **hello1.bas**.

Imagine we have saved a file called **FRED**, and then after working on it and saving a new version with the same name, realised that we had made a terrible mistake and would like to recover the last version. This would be possible using the commands:

```
ERASE "fred"
MOVE "fred.bak" TO "fred"
```

If a file you're moving or renaming already exists (or rather another file with the same name) at the intended destination, **MOVE** will fail with an **Already exists, 0:1** error.

**MOVE**'s dot command alternative is **.mv** and unlike other dot command alternatives we've examined so far, its renaming and moving capabilities far exceed those of **MOVE**'s. It allows *operations* across different drives, *interactive* or *automatic overwriting* of already existing files as well as the full use of *wildcards*. It's syntax is:

**.mv** [**OPTION**] [**-T**] *source destination* –or–\
**.mv** [**OPTION**] *source* **DIR** –or–\
**.mv** [**OPTION**] -t *DIR source*

Where *source* and *destination* can be any valid *NextZXOS filespec* (including *wildcards*) and *DIR* is any valid *folder* . *Source* or *Destination filespecs* with trailing slash characters (/ or \) are considered to be folders. As **.mv** has numerous options, they are listed in the table below to help you better understand what it can do. In general when you have a large quantity of files to be moved or renamed it's better to use **.mv** over **MOVE**.

<table>
<thead>
<tr><th>Option</th><th>Alt Option Syntax</th><th>Description</th><th>Notes</th></tr>
</thead>
<tbody>
<tr><td>-b</td><td></td><td>Makes backup of existing destination</td><td></td></tr>
<tr><td>-f</td><td>--force</td><td>Do not prompt for overwrite</td><td rowspan="3">Of these three options, the last in order is the one that takes effect</td></tr>
<tr><td>-i</td><td>--interactive</td><td>Prompt for overwrite</td></tr>
<tr><td>-n</td><td>--no-clobber</td><td>Do not overwrite</td></tr>
<tr><td></td><td>--strip-trailing-slashes</td><td>Remove slashes from names</td><td></td></tr>
<tr><td>-S</td><td>--suffix=SUFFIX</td><td>Override default backup suffix with SUFFIX</td><td></td></tr>
<tr><td></td><td>--system</td><td>Match system files to source</td><td></td></tr>
<tr><td>-t DIR</td><td>--target-directory=DIR</td><td>Move everything in source to folder DIR</td><td></td></tr>
<tr><td>-T</td><td>--no-target-directory</td><td>Treat destination as a normal file</td><td></td></tr>
<tr><td>-u</td><td>--update</td><td>Move only if source is newer than destination or destination doesn't exist</td><td></td></tr>
<tr><td>-v</td><td>--verbose</td><td>Explain what is being done</td><td></td></tr>
<tr><td>-h</td><td>--help</td><td>Prints this list of options</td><td></td></tr>
<tr><td>-v</td><td>--version</td><td>Prints the version of .rm and exits</td><td></td></tr>
</tbody>
</table>

*Table 16 – .rm options*

### File attributes

As mentioned in the previous section, **MOVE** has another use besides renaming and moving files and that is to change a file's attributes. Attributes are bits of information associated with a file that tell you (and the computer) a little more about it. You already saw in the **CAT EXP** and **ERASE** examples how attributes appear to you and how they can affect your files. There are three attributes that can be changed plus one more that is automatically managed: *write protection*, *system status* and *archive*. The most useful attribute is, as

