DIR$()

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
DIR$( [fspec [, type ]] )
CHDIR
MKDIR dir$
RMDIR dir$

Description:

DIR$( [fspec [, type ]] )

Will search an SD card for files and return the names of entries found.

'fspec' is a file specification using wildcards the same as used by the FILES command.  
Eg, "*.*" will return all entries, "*.TXT" will return text files.

'type' is the type of entry to return and can be one of:
VOL        Search for the volume label only
DIR          Search for directories only
FILE        Search for files only (the default if 'type' is not specified)

The function will return the first entry found.
To retrieve subsequent entries use the function with no arguments.
ie,  DIR$().
The return of an empty string indicates that there are no more entries to retrieve.

This example will print all the files in a directory:

 f$ = DIR$("*.*", FILE)
 DO WHILE f$ <> ""
   PRINT f$
   f$ = DIR$()
 LOOP

You must change to the required directory before invoking this command.

CHDIR

Change the current working directory on the SD card to ‘dir$’
The special entry “..” represents the parent of the current directory and “.” represents the current directory.  "/" is the root directory.

MKDIR dir$

Make, or create, the directory ‘dir$’ on the SD card.

MKDIR "test\test2"

This only works if the first level folder ("test") exists.

RMDIR dir$

Remove, or delete, the directory ‘dir$’ on the SD card.
If the directory is not empty, an error is returned.

RMDIR "test"

Access denied due to prohibited access or directory full

Last edited: 29 September, 2020