copy-file(3)
[Home]
[Commands]
[Variables]
[Macro-Dev]
[Glossary]
NAME
copy-file - Copy or move files and directories
delete-file - Delete files and directories
delete-file - Delete file after a specified delay
SYNOPSIS
DESCRIPTION
copy-file copies or moves file or directory from to file name or directory to, particular attention should be paid to the last character of to, as a trailing '/' is assumed to be a destination directory as opposed to the destination name. For example:
copy-file "a/" "b"
will copy directory a to b, effectively renaming it, whereas:
copy-file "a/" "b/"
will copy directory a into directory b/. The numeric argument n is used to modify the default behavior of the command, where the bits are defined as follows:
0x01
wWhen set copy-file copies from, when clear copy-file moves from to to.
0x02
When set the command will not prompt the user on a file read failure, the copy/move for that file will simply fail.
0x04
When set the command will not prompt the user on a file create or write failure, the copy/move for that file/directory will simply fail.
0x08
When set the command will not prompt the user on a file overwrite issue, 'no' is assumed for all, i.e. no files will be overwritten.
0x10
When set the command will not prompt the user on a file overwrite issue, 'yes' is assumed for all, i.e. any file will be overwritten if required.
0x20
When set all intermediate directories are create as required, i.e. if to evaluates to a directory that does not currently exist it will be created. If this bit is clear the command will fail if the destination directory does not yet exist.
0x40
When set the file name part of from is treated as a regular expression, as this can match multiple files to must be a directory.
0x80
When set an error is not thrown if from does not match a file.
delete-file deletes the given file or directory. The numeric argument n is used to modify the default behavior of the command, where the bits are defined as follows:
0x01
When set the command will return an error if the given file does not exist or, if a regex mask (see bit 0x20 below), match at least one file or directory.
0x02
When set the file is trashed first. While this is not guaranteed to put the file beyond recovery it should make it very much harder.
0x04
When set the command will not prompt the user on a delete failure, the delete will simply fail and move on to the next.
0x08
When set the command will not prompt the user before deleting a read-only file, 'no' is assumed and all read-only files will be skipped.
0x10
When set the command will not prompt the user before deleting a read-only file, 'yes' is assumed and all read-only files will be deleted.
0x20
When set the file name part of file is treated as a regular expression, this can be used to delete multiple files.
0x40
When set messages, including errors, are not printed.
Both commands return 4 counts in
$result(5) with the form "|<ds#>|<df#>|<fs#>|<ff#>|", a
MicroEmacs list, where the counts are defined as follows:
<ds#>
The number of directories successfully copied, moved or deleted.
<df#>
The number of directories that failed to be copied, moved or deleted.
<fs#>
The number of files successfully copied, moved or deleted.
<ff#>
The number of files that failed to be copied, moved or deleted.
The delete-file-delayed command calls delete-file with the given numeric argument n and file after the given delay, which is specified in seconds. If n is not specified a default of 0x54 is used which suppresses error messages and will not prompt the user. If the delay is not specified a default of 20 seconds is used. This command can only be used via macro code, if called directly the macro will simply check if the time for the next file deletion has be reached, it will not prompt the user for a file to delete.
NOTES
copy-file, delete-file and delete-file-delayed are macros defined in hkdirlst.emf.
SEE ALSO
Ref: copy-file(3) File: m3mac098.3 Date: 2026/03/18
(c) Copyright JASSPA 2026