Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CHDIR, MKDIR, RMDIR, and FILES Statements Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example uses the MKDIR, CHDIR, RMDIR, and FILES statements to create
' a subdirectory, display its files, move to the root directory, and
' finally remove the new directory.
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
CLS ' Clear the screen
MKDIR "\SECRET" ' Makes directory called \SECRET on the current drive
CHDIR "\SECRET" ' Changes to directory \SECRET on the current drive
OPEN "MESSAGE.DAT" FOR OUTPUT AS #1 ' Creates file in the current directory
CLOSE #1
' Show a directory listing with MESSAGE.DAT appearing in the directory.
CLS
PRINT "List of the .DAT files in the current directory:"
PRINT
FILES "*.DAT"
KILL "MESSAGE.DAT" ' Delete the file MESSAGE.DAT from the disk drive
CHDIR "\" ' Change the current directory to the root of the
' current drive
RMDIR "\SECRET" ' Remove the directory \ECRET from the current drive
END