[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.6.4 File operations

Function: touch-file path
Updates timestamp of path to the current time. If path doesn't exist, a new file with size zero is created. See also sys-utime (See section 6.21.3.4 File stats).

Function: copy-file src dst &keyword if-exists backup-suffix safe keep-timestamp
Copies file from src to dst. The source file src must exist. The behavior when the destination dst exists varies by the keyword argument if-exists;

:error
(Default) Signals an error when dst exists.
:supersede
Replaces dst to the copy of src.
:backup
Keeps dst by renaming it.
#f
Doesn't copy and returns #f when dst exists.

Copy-file returns #t after completion.

If if-exists is :backup, the keyword argument backup-suffix specifies the suffix attached to the dst to be renamed. The default value is ".orig".

By default, copy-file starts copying to dst directly. However, if the keyword argument safe is a true value, it copies the file to a temporary file in the same directory of dst, then renames it to dst when copy is completed. If copy is interrupted for some reason, the filesystem is "rolled back" properly.

If the keyword argument keep-timestamp is true, copy-file sets the destination's timestamp to the same as the source's timestamp after copying.

Function: move-file src dst &keyword if-exists backup-suffix
Moves file src to dst. The source src must exist. The behavior when dst exists varies by the keyword argument if-exists, as follows.
:error
(Default) Signals an error when dst exists.
:supersede
Replaces dst by src.
:backup
Keeps dst by renaming it.
#f
Doesn't move and returns #f when dst exists.

Move-file returns #t after completion.

If if-exists is :backup, the keyword argument backup-suffix specifies the suffix attached to the dst to be renamed. The default value is ".orig".

The file src and dst can be on the different filesystem. In such a case, move-file first copies src to the temporary file on the same directory as dst, then renames it to dst, then removes src.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Ken Dickey on November, 28 2002 using texi2html