summaryrefslogtreecommitdiff
path: root/devdocs/elisp/create_002fdelete-dirs.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/create_002fdelete-dirs.html
new repository
Diffstat (limited to 'devdocs/elisp/create_002fdelete-dirs.html')
-rw-r--r--devdocs/elisp/create_002fdelete-dirs.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/create_002fdelete-dirs.html b/devdocs/elisp/create_002fdelete-dirs.html
new file mode 100644
index 00000000..7db23cfe
--- /dev/null
+++ b/devdocs/elisp/create_002fdelete-dirs.html
@@ -0,0 +1,18 @@
+ <h3 class="section">Creating, Copying and Deleting Directories</h3> <p>Most Emacs Lisp file-manipulation functions get errors when used on files that are directories. For example, you cannot delete a directory with <code>delete-file</code>. These special functions exist to create and delete directories. </p> <dl> <dt id="make-directory">Command: <strong>make-directory</strong> <em>dirname &amp;optional parents</em>
+</dt> <dd><p>This command creates a directory named <var>dirname</var>. If <var>parents</var> is non-<code>nil</code>, as is always the case in an interactive call, that means to create the parent directories first, if they don’t already exist. <code>mkdir</code> is an alias for this. </p></dd>
+</dl> <dl> <dt id="make-empty-file">Command: <strong>make-empty-file</strong> <em>filename &amp;optional parents</em>
+</dt> <dd><p>This command creates an empty file named <var>filename</var>. As <code>make-directory</code>, this command creates parent directories if <var>parents</var> is non-<code>nil</code>. If <var>filename</var> already exists, this command signals an error. </p></dd>
+</dl> <dl> <dt id="copy-directory">Command: <strong>copy-directory</strong> <em>dirname newname &amp;optional keep-time parents copy-contents</em>
+</dt> <dd>
+<p>This command copies the directory named <var>dirname</var> to <var>newname</var>. If <var>newname</var> is a directory name, <var>dirname</var> will be copied to a subdirectory there. See <a href="directory-names">Directory Names</a>. </p> <p>It always sets the file modes of the copied files to match the corresponding original file. </p> <p>The third argument <var>keep-time</var> non-<code>nil</code> means to preserve the modification time of the copied files. A prefix arg makes <var>keep-time</var> non-<code>nil</code>. </p> <p>The fourth argument <var>parents</var> says whether to create parent directories if they don’t exist. Interactively, this happens by default. </p> <p>The fifth argument <var>copy-contents</var>, if non-<code>nil</code>, means to copy the contents of <var>dirname</var> directly into <var>newname</var> if the latter is a directory name, instead of copying <var>dirname</var> into it as a subdirectory. </p>
+</dd>
+</dl> <dl> <dt id="delete-directory">Command: <strong>delete-directory</strong> <em>dirname &amp;optional recursive trash</em>
+</dt> <dd>
+<p>This command deletes the directory named <var>dirname</var>. The function <code>delete-file</code> does not work for files that are directories; you must use <code>delete-directory</code> for them. If <var>recursive</var> is <code>nil</code>, and the directory contains any files, <code>delete-directory</code> signals an error. If recursive is non-<code>nil</code>, there is no error merely because the directory or its files are deleted by some other process before <code>delete-directory</code> gets to them. </p> <p><code>delete-directory</code> only follows symbolic links at the level of parent directories. </p> <p>If the optional argument <var>trash</var> is non-<code>nil</code> and the variable <code>delete-by-moving-to-trash</code> is non-<code>nil</code>, this command moves the file into the system Trash instead of deleting it. See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Misc-File-Ops.html#Misc-File-Ops">Miscellaneous File Operations</a> in <cite>The GNU Emacs Manual</cite>. When called interactively, <var>trash</var> is <code>t</code> if no prefix argument is given, and <code>nil</code> otherwise. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Create_002fDelete-Dirs.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Create_002fDelete-Dirs.html</a>
+ </p>
+</div>