Difference between revisions of "DIR()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
==Class==
 
Disk and File Utilities
 
 
 
 
==Purpose==
 
==Purpose==
 
Function to perform directory search
 
Function to perform directory search
Line 43: Line 39:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 16:54, 27 November 2009

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 Server, Recital