Futurebasic/Language/Reference/folder

FOLDER FunctionEdit

FOLDEREdit

FunctionEdit

✔ Appearance ✔ Standard ✔ Console

SyntaxEdit

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

RevisedEdit

June 14, 2000 (Release 3)

DescriptionEdit

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

  • Return a reference number for the current default directory.
  • Return a reference number for a directory that you specify.
  • Change the current default directory.
  • Create a new folder.
  • Return the parent volume


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 AlsoEdit

SYSTEM function; CLOSE FOLDER; FILES$<index>