239 lines
12 KiB
HTML
239 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>Files (ECL Manual)</title>
|
|
|
|
<meta name="description" content="Files (ECL Manual)">
|
|
<meta name="keywords" content="Files (ECL Manual)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
<link href="index.html" rel="start" title="Top">
|
|
<link href="Indexes.html" rel="index" title="Indexes">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Standards.html" rel="up" title="Standards">
|
|
<link href="Streams.html#Streams" rel="next" title="Streams">
|
|
<link href="Filenames.html#Filenames" rel="prev" title="Filenames">
|
|
<style type="text/css">
|
|
<!--
|
|
/* colors */
|
|
|
|
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
|
|
span.r {font-family: initial; font-weight: normal; font-style: normal}
|
|
span:hover a.copiable-link {visibility: visible}
|
|
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
|
|
@media (prefers-color-scheme: dark) {
|
|
/* dark theme */
|
|
html { color: seashell;
|
|
background: #1A1A1A; }
|
|
body { background: #1A1A1A; }
|
|
th { border-bottom: 2px solid lightgray; }
|
|
h1, h2, h3, h4, h5 { background-image: linear-gradient(to left, #202020, #3A3A3A); }
|
|
code, var, code a { color: darkorange;
|
|
background: #2A2A2A; }
|
|
a { color: seashell; }
|
|
pre { background: #2A2A2A;
|
|
color: seashell;
|
|
/* mark longer code block with stripe on the left */
|
|
border-left: 5px solid darkorange;
|
|
padding-left: 10px; }
|
|
pre.screen { background: #2A2A2A;
|
|
border: 1px solid lightgray; }
|
|
pre.programlisting { background: #2A2A2A;
|
|
border-left: 1px solid lightgray;
|
|
border-top: 1px solid lightgray; }
|
|
/* we need a light background in order for the images to be readable */
|
|
img { background: white }
|
|
}
|
|
@media (prefers-color-scheme: light) {
|
|
/* light theme */
|
|
html { background: white }
|
|
body { background: white }
|
|
th { border-bottom: 2px solid gray; }
|
|
h1, h2, h3, h4, h5 { background: lightgray; }
|
|
code, var, code a { color: darkred;
|
|
background: whitesmoke; }
|
|
a { color: #000; }
|
|
pre { background: whitesmoke;
|
|
color: black;
|
|
/* mark longer code block with stripe on the left */
|
|
border-left: 5px solid darkred;
|
|
padding-left: 10px; }
|
|
pre.screen { background: #EEE;
|
|
border: 1px solid black; }
|
|
pre.programlisting { background: #EEEEEE;
|
|
border-left: 1px solid black;
|
|
border-top: 1px solid black; }
|
|
}
|
|
|
|
body {
|
|
margin: 1em 125px 0 10%;
|
|
line-height: 1.5em;
|
|
padding: 0 2em 1em 2em;
|
|
font: 13px Verdana,Arial, sans-serif
|
|
}
|
|
ul, dd, dl, dt { margin-top: 0; margin-bottom: 0; }
|
|
p, code, td, dl, dt {
|
|
line-height: 1.5em;
|
|
}
|
|
table {
|
|
font: inherit;
|
|
border-collapse: collapse;
|
|
}
|
|
th, td {
|
|
vertical-align: top;
|
|
}
|
|
h1, h2, h3 { padding-left: 15px; }
|
|
h4, h5 { padding-left: 5px; }
|
|
code, pre {
|
|
font-size: 1em;
|
|
font-family: monospace;
|
|
}
|
|
var {
|
|
font-size: 1em;
|
|
}
|
|
/* links inside code appear the same as the code itself */
|
|
code a {
|
|
font-weight: normal;
|
|
text-decoration: none;
|
|
}
|
|
/* but get an underline when hovering */
|
|
code a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
/* ordinary links appear in bold */
|
|
a { font-weight: bold; }
|
|
pre.verbatim {
|
|
margin: 0 0 0 0;
|
|
}
|
|
pre {
|
|
overflow: auto;
|
|
}
|
|
pre.screen {
|
|
font-weight: bold;
|
|
padding: 0.5em;
|
|
}
|
|
pre.programlisting {
|
|
padding: 0.5em;
|
|
}
|
|
div p { padding: 0 2em }
|
|
li p { padding: 0; margin: 0 }
|
|
hr { display: none; }
|
|
div.funcsynopsis p {
|
|
text-indent: -2em;
|
|
}
|
|
div.variablelist {
|
|
padding: 0 2em;
|
|
}
|
|
.type, .funcsynopsis, .symbol {
|
|
font-family: monospace;
|
|
}
|
|
.type, .symbol, .replaceable {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<div class="section-level-extent" id="Files">
|
|
<div class="nav-panel">
|
|
<p>
|
|
Next: <a href="Streams.html#Streams" accesskey="n" rel="next">Streams</a>, Previous: <a href="Filenames.html#Filenames" accesskey="p" rel="prev">Filenames</a>, Up: <a href="Standards.html" accesskey="u" rel="up">Standards</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<h3 class="section" id="Files-1">2.18 Files</h3>
|
|
|
|
|
|
<ul class="mini-toc">
|
|
<li><a href="Files.html#Files-_002d-Dictionary" accesskey="1">Dictionary</a></li>
|
|
<li><a href="Files.html#Files-_002d-C-Reference" accesskey="2">C Reference</a></li>
|
|
</ul>
|
|
<hr>
|
|
<div class="subsection-level-extent" id="Files-_002d-Dictionary">
|
|
<div class="nav-panel">
|
|
<p>
|
|
Next: <a href="Files.html#Files-_002d-C-Reference" accesskey="n" rel="next">C Reference</a>, Up: <a href="Files.html#Files" accesskey="u" rel="up">Files</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<h4 class="subsection" id="Dictionary-1">2.18.1 Dictionary</h4>
|
|
|
|
<a class="index-entry-id" id="index-directory-1"></a>
|
|
<dl class="first-deffn first-defun-alias-first-deffn">
|
|
<dt class="deffn defun-alias-deffn" id="index-directory"><span class="category-def">Function: </span><span><strong class="def-name">directory</strong> <var class="def-var-arguments">pathspec</var><a class="copiable-link" href='Files.html#index-directory'> ¶</a></span></dt>
|
|
<dd>
|
|
<p>This function does not have any additional arguments other than the ones described in ANSI [see <a class="pxref" href="Bibliography.html">ANSI</a>]. To list files and directories, it follows the rules for matching pathnames described in <a class="ref" href="Filenames.html#Filenames-_002d-Wild-pathnames-and-matching">Wild pathnames and matching</a>. In short, you have the following practical examples:
|
|
</p>
|
|
<div class="float" id="tab_003aexamples_002dusing_002ddirectory">
|
|
|
|
<table class="multitable">
|
|
<thead><tr><th width="25%">Argument</th><th width="75%">Meaning</th></tr></thead>
|
|
<tbody><tr><td width="25%"><code class="code">"/home/jlr/*.*"</code></td><td width="75%">List all files in directory <code class="code">/home/jlr/</code> Note that it lists only files, not directories!</td></tr>
|
|
<tr><td width="25%"><code class="code">"/home/jlr/*"</code></td><td width="75%">Same as before, but only files without type.</td></tr>
|
|
<tr><td width="25%"><code class="code">"/home/jlr/*/"</code></td><td width="75%">List all directories contained in <code class="code">/home/jlr/</code>. Nested directories are not navigated.</td></tr>
|
|
<tr><td width="25%"><code class="code">"/home/jlr/**/*.*"</code></td><td width="75%">List all files in all directories contained in <code class="code">/home/jlr/</code>, recursively. Nested directories are navigated.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="caption"><p><strong class="strong">Table 2.9: </strong>Examples of using <code class="code">directory</code></p></div></div></dd></dl>
|
|
|
|
<dl class="first-deffn first-defun-alias-first-deffn">
|
|
<dt class="deffn defun-alias-deffn" id="index-rename_002dfile"><span class="category-def">Function: </span><span><strong class="def-name">rename-file</strong> <var class="def-var-arguments">filespec new-name &key (if-exists :error)</var><a class="copiable-link" href='Files.html#index-rename_002dfile'> ¶</a></span></dt>
|
|
<dd>
|
|
<p>In addition to the arguments described in ANSI [see <a class="pxref" href="Bibliography.html">ANSI</a>], the <code class="code">rename-file</code> function in ECL has an <code class="code">:if-exists</code> keyword argument that specifies what happens when a file with the new name already exists. Valid values of this argument are:
|
|
</p>
|
|
<table class="multitable">
|
|
<thead><tr><th width="25%">Argument</th><th width="75%">Behaviour of the <code class="code">rename-file</code> function</th></tr></thead>
|
|
<tbody><tr><td width="25%"><code class="code">:error</code></td><td width="75%">Signal an error</td></tr>
|
|
<tr><td width="25%"><code class="code">:supersede</code>, <code class="code">t</code></td><td width="75%">Overwrite the existing file</td></tr>
|
|
<tr><td width="25%"><code class="code">nil</code></td><td width="75%">Don’t overwrite the existing file, don’t signal an error</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</dd></dl>
|
|
|
|
<hr>
|
|
</div>
|
|
<div class="subsection-level-extent" id="Files-_002d-C-Reference">
|
|
<div class="nav-panel">
|
|
<p>
|
|
Previous: <a href="Files.html#Files-_002d-Dictionary" accesskey="p" rel="prev">Dictionary</a>, Up: <a href="Files.html#Files" accesskey="u" rel="up">Files</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<h4 class="subsection" id="C-Reference-17">2.18.2 C Reference</h4>
|
|
|
|
<ul class="mini-toc">
|
|
<li><a href="Files.html#ANSI-Dictionary-10" accesskey="1">ANSI Dictionary</a></li>
|
|
</ul>
|
|
<div class="subsubsection-level-extent" id="ANSI-Dictionary-10">
|
|
<h4 class="subsubsection">2.18.2.1 ANSI Dictionary</h4>
|
|
<p>Common Lisp and C equivalence
|
|
</p>
|
|
<table class="multitable">
|
|
<thead><tr><th width="30%">Lisp symbol</th><th width="70%">C function</th></tr></thead>
|
|
<tbody><tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_del_fi.htm">delete-file</a></td><td width="70%">cl_object cl_delete_file(cl_object filespec)</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_dir.htm">directory</a></td><td width="70%">cl_object cl_directory(cl_narg narg, cl_object pathspec, ...)</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_ensu_1.htm">ensure-directories-exist</a></td><td width="70%">cl_object cl_ensure_directories_exist(cl_narg narg, cl_object pathspec, ...)</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_file_a.htm">file-author</a></td><td width="70%">cl_object cl_file_author(cl_object pathspec)</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_file_e.htm">file-error-pathname</a></td><td width="70%">[Only in Common Lisp]</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_file_w.htm">file-write-date</a></td><td width="70%">cl_object cl_file_write_date(cl_object pathspec)</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_probe_.htm">probe-file</a></td><td width="70%">cl_object cl_probe_file(cl_object pathspec)</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_rn_fil.htm">rename-file</a></td><td width="70%">cl_object cl_rename_file(cl_narg narg, cl_object filespec, cl_object new_name, ...)</td></tr>
|
|
<tr><td width="30%"><a class="url" href="http://www.lispworks.com/documentation/HyperSpec/Body/f_tn.htm">truename</a></td><td width="70%">cl_object cl_truename(cl_object filespec)</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="nav-panel">
|
|
<p>
|
|
Next: <a href="Streams.html#Streams" accesskey="n" rel="next">Streams</a>, Previous: <a href="Filenames.html#Filenames" accesskey="p" rel="prev">Filenames</a>, Up: <a href="Standards.html" accesskey="u" rel="up">Standards</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indexes.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|