<!-- PDF page 159 -->

Apart from that basic functionality; we can also *copy* or *move* files from one location (folder or drive or a combination of both) to another location, *rename* them, erase them, and *catalogue* them; that is to produce a list of all the available files in a location. These functions are possible with the use of the **COPY**, **MOVE**, **ERASE** and **CAT** commands or their *dot command* equivalents: **.cp**, **.mv, .rm** and **.ls**[^p159-6].

### Filenames

Before we visit the commands that manipulate *files*, it's best we visit the subject of *filenames* first as there are special considerations on how and why a *file* is named.

First of all, *filenames* are basically strings that are made by up to four parts (according to which *file system* we use as we will see further below) that help *NextZXOS to* uniquely identify a file. These are:

- *User Area* with *Drive Name* –or–\
  *User Area* followed by a colon (:) character if accessing files on the same drive\
  –or– *Drive Name*
- *folder* name or combination of *folder* names separated by forward (/) or backward (\\) slash characters
- *actual file* name
- suffix of a dot (.) character followed by a *file type* of up to three characters (for example **.bas**)

Of these only the third part is absolutely required and every other part is optional. Also not every part is applicable everywhere in *NextZXOS*. This strictly depends on the kind of *filesystem* the *files* are located on. For example you can only use *User Areas* on *virtual disk images*, the *RAMdisk* and *IDEDOS (+3e) partitions* but not on *FAT partitions* (we will examine these a little later), while you cannot use folders in the *RAMdisk* and *virtual disk images* as the concept of *folders* doesn't exist there[^p159-7]. Similar for *tape images* or actual tapes where you can only use *drive names* (specifically **t:**) and up to 10 charactes as a *filename* but not *folders*.

*Filenames* can be up to 255 characters in length (inclusive of dot character and the optional *type), however, for compatibility reasons on virtual disks*, *IDEDOS partitions* and the *RAMdisk*, they can only be 8 (*name*) + *3 (type) characters in length (excluding the optional user area* and *drive* letter combinations).

Finally, some characters are reserved and cannot be used to name files. Files can use the following characters:

- Letters: **abcdefghijklmnopqrstuvwxyz** (upper or lower case)
- Digits: **0123456789**
- Other characters[^p159-8]: # $ @ ↑ _ **{ }** ~ £

Upper and lower case letters are considered as having the same value for *filenames*, so *EXAMPLE* and *example* would be identical as far as *NextBASIC* is concerned. They will however be listed in the case they were stored in, when a *catalogue* is requested.

A *filename* can end with an optional *type field* which is just up to three characters[^p159-9] long that you may wish to use in order to group together or quickly identify files of the same type. If a

[^p159-6]: SAVE and LOAD do not have *dot command* equivalents as they're already available in the 48K mode personality even though the latter was conceived prior to the introduction of mass storage devices to the ZX Spectrum family of computers.
[^p159-7]: Technically for floppy disk, *IDEDOS* and Tape virtual images as well as the *RAMdisk* slash characters can be a part of a filename but they're not an organisational unit as the *folder* is and since (as we'll see later) the filenames in these cases are restricted in size, it's not advisable to use them.
[^p159-8]: Characters " and ' are available in some situations (for example for tape images or for CP/M) for filenames but are reserved under *NextBASIC* and cannot be used directly.
[^p159-9]: Type fields, separated by a dot from the name field, are up to 3 letters long as a matter of both compatibility and convention. In reality, in FAT drives like the System/Next™ card your ZX Spectrum Next came with, there are no restraints on how many dots a filename can have but any filename with the dot character located at more than 4 characters before its end, is considered to have an empty type field (always keeping within the maximum allowed length of a filename). See also the discussion regarding wildcards to see why this useful to know.

