std-file-copy | ![]() |
std-file-copy makes a binary copy from one file to another. std-file-copy will NOT overwrite any existing file! On failure it returns nil which may indicate that either:
1) from-fame is not readable, or
2) from-fame is a directory,or
3) to-fname already exists, or
4) to-fname is not writable, or
5) from-fname is the same as to-fame
It's the same as the Visual Lisp function vl-file-copy only without the third optional parameter, but backwards compatible and should be supported on other platforms too. For file appending use std-file-append.
Note:
vl-file-copy and vlx-file-copy will fail on special filenames. This is not fully tested, but it fails for sure with spaces and dots in the filename. std-file-copy checks after copying for the new file and if it does not exist falls back to a more primitive method.
(std-file-copy "/acad/test.lsp" "/acad/test.bak")
;; this will work:
(std-file-copy "long test file. With dot.lsp" "test.lsp")
;; but this will fail!
(vl-file-copy "long test file. With dot.lsp" "test.lsp")
from-fname,to-fname: Filenames. Partial or fully qualified filename specifiers without wildcards.
Any non-nil value on success (typically the number of copied bytes?) or nil.
On success it copies a file. Operating system exceptions might occur.
(std-require 'STDFILE)
Defined in STDFILE