DIR()

From Recital Documentation Wiki
Revision as of 16:30, 23 March 2009 by Yvonnemilne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Class

Disk and File Utilities


Purpose

Function to perform directory search


Syntax

DIR(<skeleton>,<expL1>,<expL2>)


See Also

ADIR(), FILE(), MENU FILES


Description

The DIR() function scans the current directory returning the names of files which match the pattern <skeleton>. If <expL1> is .T., then the scan starts at the first file in the directory otherwise it continues from the last file returned. If <expL2> is .T., then characters following ';' in the file name will be discarded, as will the ';'. The <expL2> or "trim" parameter is only of use in OpenVMS where the file names returned can have version numbers.


Example

// Delete existing text document
procedure del_files
parameter m_confirm
set message to "Operation in progress."
file_name=dir("*.txt",.T.,.T.)
do while not empty(file_name)
    if m_confirm
        dialog message "Erase &file_name.? (Y/N)"
    endif
    if lastkey()=asc('Y') or not m_confirm
        set message to "Deleting &file_name."
        erase &file_name
    endif
    file_name=dir("*.txt",.F.,.T.)
enddo
return
 
del_files(.T.)


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer