directory Class Reference


The class directory allows to read and explore the directories of the file systems of the operating system.


  • directory-constructor
  • directory-destructor
  • directory-read-line

  • List of all Inherited Classes

  • class

  • directory-constructor

    (make-instance directory arg )

    Function Type subr
    Arguments a string
    Return Value an object of class directory
    Description never call directory-constructor directly but always through make-instance

    the string passed as argument must contain a valid directory name or path (absolute or relative); the constructor fails and returns nil if the name represents any other file type; globbing or pattern matching must be implemented explicitely, eventually in a child class
    Example (setq currentdir(make-instance directory "." ))

    directory-destructor

    (destroy-instance arg )

    Function Type subr
    Arguments an object of class directory
    Return Value the result of the destructor
    Description never call directory-destructor directly but always through destroy-instance ; the destructor closes the directory handle in the process but leaves the directory itself untouched
    Example (destroy-instance currentdir)

    directory-read-line

    (read-line arg )

    Function Type subr
    Arguments a directory object, a list of keywords
    Return Value a list
    Description reads a line from the directory object passed as argument and returns it; the line is built accordingly to the keywords given as arguments;

    the keyword 'attributes adds an unsignedinteger containing the flags bits of the file; if the file is a symbolic link, the bits 16 to 31 contain the attribute of the link itself; see man 2 stat to find the values to test against to discriminate the files;

    the keyword 'created adds a string with the file creation date and time;

    the keyword 'modified adds a string with the file last modification date and time

    the keyword 'accessed adds a string with the file last access date and time

    the keyword 'size adds an integer containg the file size in bytes (up to 2^63-1);

    the keyword 'name adds a string with the file name

    if the file is a symbolic link, then:

    the keyword 'ln-created adds a string with the link creation date and time;

    the keyword 'ln-modified adds a string with the link last modification date and time

    the keyword 'ln-accessed adds a string with the link last access date and time

    the keyword 'ln-name adds a string with the file name;

    if the file is not a symbolic link, those keywords render always nil;

    all date and time strings are in the format YYYYMMDDHHMMSS

    Example (setq currentdir(make-instance directory "." ))
    (read-line currentdir 'modified 'attributes 'size 'name) => ("20061111155630" 0x41ed 328 "." )

    Updated 29/11/2008 Copyright © 2008 Walther Waeles
    SourceForge.net Logo