Futurebasic/Language/Reference/folder

< Futurebasic < Language < Reference

FOLDER Function

FOLDER

Function

✔ Appearance ✔ Standard ✔ Console

Syntax

folderRefNum% = FOLDER(path$, refNum%)
parentFolderVRef% = FOLDER(":",refNum%)

Revised

June 14, 2000 (Release 3)

Description

Depending on the parameters used, this function does several things with folders (directories). It can:

When FOLDER returns a reference number, it will either be a volume reference number (if the directory is a root directory), or a working directory reference number (if the directory is not a root directory). You can use this reference number to identify the directory when you use other FB statements such as OPEN.

This table summarizes the effects of the various parameter combinations. Note that when you use a nonzero number in refNum%, you can specify either a working directory reference number, a volume reference number, or a drive ID number. When you specify a volume reference number or a drive ID number, it represents the root directory on the specified volume.

In

Out

Function

path$

refNum%

Value returned

Get the reference number of the current default directory

"" (blank)

zero

Reference number of current default directory

Get the reference number of the parent folder
":" (colon)
any nonzero number
Reference number of the parent folder. If no parent folder, it will return refNum%

Get a reference number for a directory relative to the current directory

partial path

zero

Reference number of specified directory, or zero if directory doesn’t exist

Get a reference number for an arbitrary directory

full path

zero

Reference number of specified directory, or zero if directory doesn’t exist

Change default directory

blank

non-zero reference number

Same number as refNum%

Create a directory relative to refNum%

partial path

non-zero reference number

If the path and refNum% refer to an existing folder, its reference number

Create an arbitrary directory

full path

any non-zero number

If the path is invalid or path and refNum% refer to an existing file, zero

Note:
The reference number returned in folderRefNum% is a temporary number, which is only valid until your program quits. You cannot use this same number to refer to this folder at a later date. If you need to keep track of a file's location over time, create an alias record for the file.

See Also

SYSTEM function; CLOSE FOLDER; FILES$<index>

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.