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.

OptionAlt Option SyntaxDescriptionNotes
-bMakes backup of existing destination
-f--forceDo not prompt for overwriteOf these three options, the last in order is the one that takes effect
-i--interactivePrompt for overwrite
-n--no-clobberDo not overwrite
--strip-trailing-slashesRemove slashes from names
-S--suffix=SUFFIXOverride default backup suffix with SUFFIX
--systemMatch system files to source
-t DIR--target-directory=DIRMove everything in source to folder DIR
-T--no-target-directoryTreat destination as a normal file
-u--updateMove only if source is newer than destination or destination doesn't exist
-v--verboseExplain what is being done
-h--helpPrints this list of options
-v--versionPrints the version of .rm and exits

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


ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.