LIST-DIR

REBOL Dictionary 2.0


Summary:

Prints a multi-column sorted listing of a directory.

Usage:

list-dir dir

Arguments:

dir - Directory to list or nothing (must be: any-type)

Description:

Lists the files and directories of the specified path in a sorted multi-column output. If no path is specified, the directory specified in system/script/path is listed. Directory names are followed by a slash (/) in the output listing.


    list-dir
    autos.txt          comments.r         data               data.r    
         
    date.r             datetime.txt       dict-html.r        dictionary
.html    
    dictionary.r       file.comp          file.decomp        file.txt  
         
    helloworld.txt     install.r          junkme.txt         newfile.tx
t        
    proj.err           rebol-logo.png     rebol-test-file.r  test-file 
         
    test-file.txt      test-image.png     test-page.html     trash.me  
         
    whoosh.wav         words.r            words/

To obtain a block of files for use by your program, use the LOAD function. The example below returns a block that contains the names of all files and directories in the local directory.


    files: load %./
    print length? files
    probe files
    27
    [%autos.txt %comments.r %data %data.r %date.r %datetime.txt %dict-h
tml.r %dictionary.html %dictionary.r %file.comp %file.decomp %file.txt %
helloworld.txt %install.r %junkme.txt %newfile.txt %proj.err %rebol-logo
.png %rebol-test-file.r %test-file %test-file.txt %test-image.png %test-
page.html %trash.me %whoosh.wav %words/ %words.r]

Related:

change-dir - Changes the active directory path.
make-dir - Creates the specified directory. No error if already exists.
read - Reads from a file, url, or port-spec (block or object).
what-dir - Prints the active directory path


<Back | Index | Next>

Copyright 2003 REBOL Technologies