| 1 |
@node Files |
| 2 |
@section Files |
| 3 |
|
| 4 |
@menu |
| 5 |
* Files - Dictionary:: |
| 6 |
* Files - C Reference:: |
| 7 |
@end menu |
| 8 |
|
| 9 |
@node Files - Dictionary |
| 10 |
@subsection Dictionary |
| 11 |
|
| 12 |
@lspindex directory |
| 13 |
@defun directory pathspec |
| 14 |
|
| 15 |
This function does not have any additional arguments other than the ones described in ANSI @bibcite{ANSI}. To list files and directories, it follows the rules for matching pathnames described in @ref{Filenames - Wild pathnames and matching}. In short, you have the following practical examples: |
| 16 |
|
| 17 |
@float Table, tab:examples-using-directory |
| 18 |
@caption{Examples of using @code{directory}} |
| 19 |
@multitable @columnfractions .25 .75 |
| 20 |
@headitem Argument @tab Meaning |
| 21 |
@item @code{"/home/jlr/*.*"} @tab List all files in directory @code{/home/jlr/} Note that it lists only files, not directories! |
| 22 |
@item @code{"/home/jlr/*"} @tab Same as before, but only files without type. |
| 23 |
@item @code{"/home/jlr/*/"} @tab List all directories contained in @code{/home/jlr/}. Nested directories are not navigated. |
| 24 |
@item @code{"/home/jlr/**/*.*"} @tab List all files in all directories contained in @code{/home/jlr/}, recursively. Nested directories are navigated. |
| 25 |
@end multitable |
| 26 |
@end float |
| 27 |
@end defun |
| 28 |
|
| 29 |
@defun rename-file filespec new-name &key (if-exists :error) |
| 30 |
|
| 31 |
In addition to the arguments described in ANSI @bibcite{ANSI}, the @code{rename-file} function in ECL has an @code{:if-exists} keyword argument that specifies what happens when a file with the new name already exists. Valid values of this argument are: |
| 32 |
|
| 33 |
@multitable @columnfractions .25 .75 |
| 34 |
@headitem Argument @tab Behaviour of the @code{rename-file} function |
| 35 |
@item @code{:error} @tab Signal an error |
| 36 |
@item @code{:supersede}, @code{t} @tab Overwrite the existing file |
| 37 |
@item @code{nil} @tab Don't overwrite the existing file, don't signal an error |
| 38 |
@end multitable |
| 39 |
@end defun |
| 40 |
|
| 41 |
@node Files - C Reference |
| 42 |
@subsection C Reference |
| 43 |
|
| 44 |
@subsubsection ANSI Dictionary |
| 45 |
Common Lisp and C equivalence |
| 46 |
|
| 47 |
@multitable @columnfractions .3 .7 |
| 48 |
@headitem Lisp symbol @tab C function |
| 49 |
@item @clhs{f_del_fi.htm,delete-file} @tab cl_object cl_delete_file(cl_object filespec) |
| 50 |
@item @clhs{f_dir.htm,directory} @tab cl_object cl_directory(cl_narg narg, cl_object pathspec, ...) |
| 51 |
@item @clhs{f_ensu_1.htm,ensure-directories-exist} @tab cl_object cl_ensure_directories_exist(cl_narg narg, cl_object pathspec, ...) |
| 52 |
@item @clhs{f_file_a.htm,file-author} @tab cl_object cl_file_author(cl_object pathspec) |
| 53 |
@item @clhs{f_file_e.htm,file-error-pathname} @tab [Only in Common Lisp] |
| 54 |
@item @clhs{f_file_w.htm,file-write-date} @tab cl_object cl_file_write_date(cl_object pathspec) |
| 55 |
@item @clhs{f_probe_.htm,probe-file} @tab cl_object cl_probe_file(cl_object pathspec) |
| 56 |
@item @clhs{f_rn_fil.htm,rename-file} @tab cl_object cl_rename_file(cl_narg narg, cl_object filespec, cl_object new_name, ...) |
| 57 |
@item @clhs{f_tn.htm,truename} @tab cl_object cl_truename(cl_object filespec) |
| 58 |
@end multitable |