2.18 Files


2.18.1 Dictionary

Function: directory pathspec

This function does not have any additional arguments other than the ones described in ANSI [see ANSI]. To list files and directories, it follows the rules for matching pathnames described in Wild pathnames and matching. In short, you have the following practical examples:

ArgumentMeaning
"/home/jlr/*.*"List all files in directory /home/jlr/ Note that it lists only files, not directories!
"/home/jlr/*"Same as before, but only files without type.
"/home/jlr/*/"List all directories contained in /home/jlr/. Nested directories are not navigated.
"/home/jlr/**/*.*"List all files in all directories contained in /home/jlr/, recursively. Nested directories are navigated.

Table 2.9: Examples of using directory

Function: rename-file filespec new-name &key (if-exists :error)

In addition to the arguments described in ANSI [see ANSI], the rename-file function in ECL has an :if-exists keyword argument that specifies what happens when a file with the new name already exists. Valid values of this argument are:

ArgumentBehaviour of the rename-file function
:errorSignal an error
:supersede, tOverwrite the existing file
nilDon’t overwrite the existing file, don’t signal an error

2.18.2 C Reference

2.18.2.1 ANSI Dictionary

Common Lisp and C equivalence

Lisp symbolC function
delete-filecl_object cl_delete_file(cl_object filespec)
directorycl_object cl_directory(cl_narg narg, cl_object pathspec, ...)
ensure-directories-existcl_object cl_ensure_directories_exist(cl_narg narg, cl_object pathspec, ...)
file-authorcl_object cl_file_author(cl_object pathspec)
file-error-pathname[Only in Common Lisp]
file-write-datecl_object cl_file_write_date(cl_object pathspec)
probe-filecl_object cl_probe_file(cl_object pathspec)
rename-filecl_object cl_rename_file(cl_narg narg, cl_object filespec, cl_object new_name, ...)
truenamecl_object cl_truename(cl_object filespec)