-------------------------------------------------------------------------------
help for dirlist                                    (version 1.3.1, 2005-04-04)
-------------------------------------------------------------------------------

Retrieve directory information

dirlist [filespec]

Description

dirlist is used as the dir command, but retrieves the information about files in in return macros (see below).

filespec may be any valid Windows, Unix, or Macintosh file path or file specification (see [U] 14.6 File-naming conventions) and may include "*" to indicate any string of characters.

Directory data are written to a temporary file using shell commands (Windows dir and Mac OS X or Unix ls) and subsequently read by the program. On Windows, dates are given in the format that the shell command provides, on Mac OS X and Unix the ISO date format YYYY-MM-DD is used.

Mac OS X: Spaces in the filespec should be preceded by an escape character "\".

Examples

. dirlist dm50*.do

You can then access the returned results:

. return list

macros: r(nfiles) : "4" r(fsizes) : "814 209 296 493" r(ftimes) : "13:27:15 13:29:05 12:22:01 13:41:09" r(fdates) : "2003-10-30 2003-10-30 2003-10-30 2003-10-30" r(fnames) : "dm501.do dm502.do dm503.do dm504.do" . dirlist ~/DM\ data/dm50*.do (Mac OS X, space in directory name)

Note

The ado-file has been tested on Mac OS X, Windows XP and one type of Linux. Possible problems could occur caused by the layout of directory lists regarding column arrangement and date format.

Author

Morten Andersen, Research Unit for General Practice University of Southern Denmark, Denmark mandersen@health.sdu.dk

Also see

Online: help for dir, shell, return