Function | Package: system | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## copy-file

Arguments: from to &key link overwrite preserve-symbolic-links preserve-time remove-destination force verbose

The `:osi` module (see Operating System Interface Functionality in os-interface.htm) has additional functionality relating to file handling. See particularly OSI file handling functionality in that document. The symbol `sys:copy-file` is exported from the new `excl.osi` package (as well as from the `system` package).

Copies from to to. If overwrite is non-`nil`, to will be overwritten if it exists.

If remove-destination is specified true, to is removed (if it exists) before the copy is attempted. (You might want to specify this if you have write permission for the directory but not for the file.) If force is specified true, if an error occurs opening to for overwriting, to is removed and the operation is retried. `:force true` essentially means overwrite if you can, remove if you must (when to exists). force and overwrite are effectively ignored when remove-destination is specified true.

It is an error to specify an existing file as the value of to unless at least one of the overwrite, remove-destination, or force keyword arguments is specified true.

The link argument only has meaning on UNIX platforms (symbolic and hard links are not supported on Windows) so it is ignored on Windows. On UNIX, it can have the following values:

- `t`: if link is `t`, then perform the copy by creating a hard link if the source and destination are on the same filesystem and by creating a symbolic link if they are on different filesystems.
- `:hard`: if link is `:hard`, then perform the copy by creating a hard link.
- `nil` (the default): if link is `nil`, then just copy the file.

In earlier releases, the link argument was called link-ok. link-ok is still accepted and its value is made the value of link (it is an error to supply values for both link and link-ok). Use of link-ok is deprecated.

If preserve-symbolic-links is true, copy a symbolic link by making a symbolic link, otherwise copy normally--link is ignored if from is a symbolic link. Because symbolic links are not supported on Windows, this argument has meaning on UNIX only. preserve-symbolic-links defaults to `nil`.

If preserve-time is true, then the time on to is set to be the same as from. preserve-time defaults to `t`.

Either of both from and to can be streams (in which case irrelevant keyword arguments are ignored). This allows for copying bytes from one stream to another or a stream to or from a file.

If the verbose argument is specified true, infomation will be printed about the copying operation.

In earlier releases, copy-file accepted an element-type keyword argument to specify the element type of the streams opened to the file to be copied and the new file. That argument was not in fact useful and has been removed. A warning is signaled if it is specified.

See Filesystem manipulation functions in os-interface.htm for information on file and directory information and manipulation functions in Allegro CL.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version